public void GetAll_ReturnsEmptyList_PastryList() { List <Pastry> newList = new List <Pastry> { }; List <Pastry> result = Pastry.GetAll(); CollectionAssert.AreEqual(newList, result); }
public void PastryOrder_CalculateTotalCostOfPastryOrders_Double() { Pastry uOrder = new Pastry(9); Pastry yOrder = new Pastry(2); int num = Pastry.GetAll(); double final = Pastry.PastryOrder(num); Assert.AreEqual(19, final); }
public void GetAll_ReturnsItems_PastryList() { string description = "this is surely a Pastry"; int price = 2; Pastry newPastry = new Pastry(description, price); List <Pastry> newList = new List <Pastry> { newPastry }; List <Pastry> result = Pastry.GetAll(); CollectionAssert.AreEqual(newList, result); }
GetAll_ReturnsPastryList_PastryList() { string pastryType1 = "biscuit"; string pastryType2 = "croissant"; Pastry pastry1 = new Pastry(pastryType1, 2); Pastry pastry2 = new Pastry(pastryType2, 2); List <Pastry> newPastryList = new List <Pastry> { pastry1, pastry2 }; List <Pastry> result = Pastry.GetAll(); List <Pastry> falsePastryList = new List <Pastry> { pastry1, }; CollectionAssert.AreEqual(newPastryList, result); }
public void GetAll_ReturnsPastries_PastryList() { //Arrange int pastries01 = 3; int pastries02 = 10; Pastry newPastry1 = new Pastry(pastries01); Pastry newPastry2 = new Pastry(pastries02); List <Pastry> newList = new List <Pastry> { newPastry1, newPastry2 }; //Act List <Pastry> result = Pastry.GetAll(); //Assert CollectionAssert.AreEqual(newList, result); }
public static void Main() { Console.WriteLine("Would you like to order some of our fine Breads? ['Y' for yes, 'Enter' for no]"); string breadYesOrNo = Console.ReadLine().ToLower(); if (breadYesOrNo == "y") { Console.WriteLine("What type of bread do you want?['french' or 'pita']"); string breadSelection = Console.ReadLine(); Console.WriteLine("How many?"); int breadQuant = int.Parse(Console.ReadLine()); Bread breadOrder = new Bread(breadSelection, breadQuant); int breadGt = breadOrder.GetSaleCost(); Main(); } Console.WriteLine("Would you like to order some of our fine Pastries? ['Y' for yes, 'Enter' for no]"); string pastryYesOrNo = Console.ReadLine().ToLower(); if (pastryYesOrNo == "y") { Console.WriteLine("What type of pastry do you want?"); string pastrySelection = Console.ReadLine(); Console.WriteLine("How many?"); int pastryQuant = int.Parse(Console.ReadLine()); Pastry newPastryOrder = new Pastry(pastrySelection, pastryQuant); int pastryGt = newPastryOrder.GetSaleCost(); } List <Bread> breadBasket = Bread.GetAll(); List <Pastry> pastryBasket = Pastry.GetAll(); foreach (Bread bread in breadBasket) { int breadGt = bread.GetSaleCost(); Console.WriteLine("Total Bread: " + breadGt); } foreach (Pastry pastry in pastryBasket) { int pastryGt = pastry.GetSaleCost(); Console.WriteLine("Total Pastry: " + pastryGt); } }
public static void Main() { Console.WriteLine("Welcome to Pierre's Bakery!"); Console.WriteLine("--------------------------"); Console.WriteLine("Today's Daily Deals:"); Console.WriteLine("--------------------------"); Console.WriteLine("Bread: Buy 2, get 1 free. A single loaf costs $5."); Console.WriteLine("Pastries: Buy 1 for $2, or 3 for $5."); Console.WriteLine("--------------------------"); Console.WriteLine("What would you like to purchase today (Bread/Pastries/Exit)"); string response = Console.ReadLine().ToLower(); if (response == "bread") { List <Bread> result = Bread.GetAll(); Console.WriteLine("How many loaves of bread would you like to purchase? (e.g. 2)"); string stringBreadLoaves = Console.ReadLine(); bool success = Int32.TryParse(stringBreadLoaves, out int number); if (success) { int breadLoavesToNum = int.Parse(stringBreadLoaves); if (breadLoavesToNum % 3 == 0) { Bread newBread = new Bread(breadLoavesToNum); Console.WriteLine(newBread.TotBreadLoavesCost(breadLoavesToNum)); Console.WriteLine("You got the best price on bread!"); } else if (breadLoavesToNum % 3 != 0) { Bread newBread = new Bread(breadLoavesToNum); Console.WriteLine(newBread.TotBreadLoavesCost(breadLoavesToNum)); Console.WriteLine("You should consider adding more loaves to your order to get a better deal."); } else { Console.Write("I'm sorry, something went wrong. Please try again."); Console.WriteLine("~~~~~~~~~"); } } else { Console.Write("I'm sorry, something went wrong."); Console.WriteLine("~~~~~~~~~"); } Program.Main(); } else if (response == "pastries") { List <Pastry> result = Pastry.GetAll(); Console.WriteLine("How many pastries would you like to purchase? (e.g. 2)"); string stringPastries = Console.ReadLine(); bool success = Int32.TryParse(stringPastries, out int number); if (success) { int pastryStringToNum = int.Parse(stringPastries); if (pastryStringToNum % 3 == 0) { Pastry newPastry = new Pastry(pastryStringToNum); Console.WriteLine(newPastry.TotPastryCost(pastryStringToNum)); Console.WriteLine("You got the best deal on pastries!"); } else if (pastryStringToNum % 3 != 0) { Pastry newPastry = new Pastry(pastryStringToNum); Console.WriteLine(newPastry.TotPastryCost(pastryStringToNum)); Console.WriteLine("You should consider adding more pastries to your order to get a better deal."); } else { Console.Write("I'm sorry, something went wrong."); Console.WriteLine("~~~~~~~~~"); } } else { Console.Write("I'm sorry, something went wrong."); Console.WriteLine("~~~~~~~~~"); } Program.Main(); } else if (response == "exit") { Console.WriteLine("Come again soon! Goodbye!"); } else { Console.WriteLine("I'm not sure what you mean. Please try again."); Program.Main(); } }