You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
751 B
41 lines
751 B
// See https://aka.ms/new-console-template for more information
|
|
|
|
using Model;
|
|
|
|
|
|
Console.WriteLine("Hello, World!\n");
|
|
|
|
|
|
// TESTS:
|
|
|
|
BaseItem r1 = new Recipe("A recipe...");
|
|
|
|
r1.DisplayItem();
|
|
r1.DisplayId();
|
|
r1.DisplayDescription();
|
|
|
|
Console.WriteLine();
|
|
|
|
RecipeCollection rc = new RecipeCollection("A recipe collection...");
|
|
for (uint i = 0; i < 10; i++)
|
|
{
|
|
rc += new Recipe($"Recipe number {i} in the collection."); // test overload + operator
|
|
}
|
|
|
|
try // test overload of [] operator
|
|
{
|
|
rc[1003].DisplayItem();
|
|
rc[2003].DisplayItem(); // incorrect index
|
|
}
|
|
catch (ArgumentNullException)
|
|
{
|
|
Console.Error.WriteLine("An index are incorrect!\n");
|
|
}
|
|
|
|
|
|
foreach (Recipe r in rc.Collection)
|
|
{
|
|
r.DisplayId();
|
|
r.DisplayDescription();
|
|
}
|