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.
56 lines
1.1 KiB
56 lines
1.1 KiB
// See https://aka.ms/new-console-template for more information
|
|
|
|
using Model;
|
|
|
|
|
|
Console.WriteLine("Hello, World!\n");
|
|
|
|
|
|
// TESTS:
|
|
|
|
Console.WriteLine("tests on Recipe class:");
|
|
BaseItem r1 = new Recipe("A recipe...");
|
|
|
|
r1.DisplayItem();
|
|
r1.DisplayId();
|
|
r1.DisplayDescription();
|
|
|
|
Console.WriteLine();
|
|
|
|
Console.WriteLine("tests on RecipeCollection class:");
|
|
RecipeCollection rc = new RecipeCollection("A recipe collection...");
|
|
for (uint i = 0; i < 10; i++)
|
|
{
|
|
rc += new Recipe($"Recipe number {i} in the collection.");
|
|
Console.WriteLine("test overload + operator");
|
|
}
|
|
|
|
Console.WriteLine("test overload of [] operator:");
|
|
try
|
|
{
|
|
rc[2].DisplayId();
|
|
rc.GetById(110).DisplayId();
|
|
}
|
|
catch (ArgumentNullException)
|
|
{
|
|
Console.Error.WriteLine("An index are incorrect!\n");
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Console.Error.WriteLine("Exception thrown: {0}", e);
|
|
}
|
|
|
|
Console.WriteLine("test of multiple params constructor:");
|
|
RecipeCollection rc2 = new RecipeCollection(
|
|
new Recipe(),
|
|
new Recipe(),
|
|
new Recipe(),
|
|
new Recipe(),
|
|
new Recipe());
|
|
|
|
Console.WriteLine("test of Enumerable property:");
|
|
foreach (Recipe r in rc2)
|
|
{
|
|
r.DisplayId();
|
|
}
|