private void Test_CheckCrustAdded() { // arrange var sut = new MeatPizza(); // inference List <Crust> crusts = new List <Crust>() { new Crust { EntityId = 1, Name = "Thin", Price = .99m }, new Crust { EntityId = 2, Name = "Regular", Price = 1.99m }, new Crust { EntityId = 3, Name = "Large", Price = 2.99m } }; // act sut.AddCrust(crusts); var actual = sut; // assert Assert.IsType <Crust>(actual.Crust); Assert.NotNull(actual.Crust); }
private void Test_VerifyPricingComputation() { // arrange var sut = new MeatPizza(); // inference List <Crust> crusts = new List <Crust>() { new Crust { EntityId = 1, Name = "Thin", Price = .99m }, new Crust { EntityId = 2, Name = "Regular", Price = 1.99m }, new Crust { EntityId = 3, Name = "Large", Price = 2.99m } }; List <Size> sizes = new List <Size>() { new Size { EntityId = 1, Name = "Small", Inches = 10, Price = .99m }, new Size { EntityId = 2, Name = "Medium", Inches = 12, Price = 2.99m }, new Size { EntityId = 3, Name = "Large", Inches = 14, Price = 4.99m } }; List <Topping> toppings = new List <Topping>() { new Topping { EntityId = 1, Name = "Cheese" }, new Topping { EntityId = 2, Name = "Pepperoni" }, new Topping { EntityId = 3, Name = "Sausage" }, new Topping { EntityId = 4, Name = "Pineapple" } }; sut.AddCrust(crusts); sut.AddSize(sizes); sut.AddToppings(toppings); // act var actual = sut.GetTotalPrice(); // assert Assert.True(actual == 10.97m); }
private void Test_VerifyOrderTally() { // arrange var order = new Order(); var meat = new MeatPizza(); var pineapple = new PineapplePizza(); List <Crust> crusts = new List <Crust>() { new Crust { EntityId = 1, Name = "Thin", Price = .99m }, new Crust { EntityId = 2, Name = "Regular", Price = 1.99m }, new Crust { EntityId = 3, Name = "Large", Price = 2.99m } }; List <Size> sizes = new List <Size>() { new Size { EntityId = 1, Name = "Small", Inches = 10, Price = .99m }, new Size { EntityId = 2, Name = "Medium", Inches = 12, Price = 2.99m }, new Size { EntityId = 3, Name = "Large", Inches = 14, Price = 4.99m } }; List <Topping> toppings = new List <Topping>() { new Topping { EntityId = 1, Name = "Cheese" }, new Topping { EntityId = 2, Name = "Pepperoni" }, new Topping { EntityId = 3, Name = "Sausage" }, new Topping { EntityId = 4, Name = "Pineapple" } }; meat.AddCrust(crusts); meat.AddSize(sizes); meat.AddToppings(toppings); pineapple.AddCrust(crusts); pineapple.AddSize(sizes); pineapple.AddToppings(toppings); order.Pizzas.Add(meat); order.Pizzas.Add(pineapple); // act var actual = order.GetCurrentTally(); // assert Assert.True(actual == 21.94m); }
private void Test_CheckToString() { // arrange var user = new User("test", "12345"); var store = new Store(); store.Name = "First Store"; user.SelectedStore = store; var order = new Order(); var meat = new MeatPizza(); var pineapple = new PineapplePizza(); List <Crust> crusts = new List <Crust>() { new Crust { EntityId = 1, Name = "Thin", Price = .99m }, new Crust { EntityId = 2, Name = "Regular", Price = 1.99m }, new Crust { EntityId = 3, Name = "Large", Price = 2.99m } }; List <Size> sizes = new List <Size>() { new Size { EntityId = 1, Name = "Small", Inches = 10, Price = .99m }, new Size { EntityId = 2, Name = "Medium", Inches = 12, Price = 2.99m }, new Size { EntityId = 3, Name = "Large", Inches = 14, Price = 4.99m } }; List <Topping> toppings = new List <Topping>() { new Topping { EntityId = 1, Name = "Cheese" }, new Topping { EntityId = 2, Name = "Pepperoni" }, new Topping { EntityId = 3, Name = "Sausage" }, new Topping { EntityId = 4, Name = "Pineapple" } }; meat.AddCrust(crusts); meat.AddSize(sizes); meat.AddToppings(toppings); pineapple.AddCrust(crusts); pineapple.AddSize(sizes); pineapple.AddToppings(toppings); order.Pizzas.Add(meat); order.Pizzas.Add(pineapple); user.Orders.Add(order); // act var actual = user.ToString(); // assert Assert.True(actual == "you have selected this store: First Store and ordered these pizzas: Meat Pizza\nPineapple Pizza\n"); }