public void GetDescription_SmallPizza_ReturnsBaseDescription() { var pizza = new SmallPizza(); var result = pizza.GetDescription(); Assert.Equal("Small pizza", result); }
public void TopingsCanBeAdded() { IMenuItem pizza = new SmallPizza(); pizza.AddTopping(new Mushrooms()); Assert.Pass(); }
public void CanGetDescriptionOfItem() { HalfCalzone halfCalzone = new HalfCalzone(); halfCalzone.AddTopping(new Mushrooms()); Assert.AreEqual( "half calzone with mushrooms", halfCalzone.Description() ); FullCalzone fullCalzone = new FullCalzone(); fullCalzone.AddTopping(new Mushrooms()); fullCalzone.AddTopping(new BellPeppers()); Assert.AreEqual( "full calzone with mushrooms and bell peppers", fullCalzone.Description() ); SmallPizza smallPizza = new SmallPizza(); smallPizza.AddTopping(new Mushrooms()); smallPizza.AddTopping(new BellPeppers()); smallPizza.AddTopping(new CherryTomatoes()); Assert.AreEqual( "small pizza with mushrooms, bell peppers and cherry tomatoes", smallPizza.Description() ); }
public void GetCost_SmallPizza_ReturnsBasePrice() { var pizza = new SmallPizza(); var result = pizza.GetCost(); Assert.Equal(6.00, result); }
private void Opslaan() { try { string stringetje = "Bestelling_" + DateTime.Now.ToShortDateString().Replace("/", "-") + "om" + DateTime.Now.ToShortTimeString().Replace(":", "-"); SaveFileDialog dlg = new SaveFileDialog(); dlg.FileName = stringetje; dlg.DefaultExt = ".pizza"; dlg.Filter = "Pizza bestelDocument |*.pizza"; if (dlg.ShowDialog() == true) { using (StreamWriter bestand = new StreamWriter(dlg.FileName)) { bestand.WriteLine(SmallPizza.ToString()); bestand.WriteLine(MediumPizza.ToString()); bestand.WriteLine(LargePizza.ToString()); bestand.WriteLine(DikkeKorst.ToString()); bestand.WriteLine(ExtraKaas.ToString()); bestand.WriteLine(AantalPizzas); bestand.WriteLine(Ham.ToString()); bestand.WriteLine(Ananas.ToString()); bestand.WriteLine(Salami.ToString()); } } } catch (Exception ex) { MessageBox.Show("Kan het bestand niet opslaan \n" + ex.Message); } }
public void SmallPizza() { var pizza = new SmallPizza(); Assert.AreEqual(pizza.Description(), "Small Pizza"); Assert.AreEqual(pizza.Cost(), 3.00); }
private void CreatePizza(List <ObjType> types, Vector3 pizzaPosition, Transform parent) { Pizza pizza = new SmallPizza(); for (int i = 0; i < types.Count; i++) { if (types [i] == ObjType.CHICKEN) { pizza = new ChickenDecorator(pizza); } if (types [i] == ObjType.HAM) { pizza = new HamDecorator(pizza); } if (types [i] == ObjType.MUSHROOM) { pizza = new MushroomDecorator(pizza); } } GameObject pizzaObj = pizza.CreatePizza(pizzaPosition + new Vector3(0f, 0f, -2f)); pizzaObj.transform.SetParent(parent); pizzaObj.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f); }
bool IsPlacable(int pizzaNumber) { if (type == ObjType.PIZZA && pizzas [pizzaNumber] == null) { pizzas [pizzaNumber] = new SmallPizza(); return(true); } else if (type != ObjType.PIZZA) { if (pizzas [pizzaNumber] != null) { if (type == ObjType.CHICKEN) { pizzas [pizzaNumber] = new ChickenDecorator(pizzas [pizzaNumber]); } else if (type == ObjType.HAM) { pizzas [pizzaNumber] = new HamDecorator(pizzas [pizzaNumber]); } else if (type == ObjType.MUSHROOM) { pizzas [pizzaNumber] = new MushroomDecorator(pizzas [pizzaNumber]); } return(true); } } return(false); }
public void ReturnDescription_WhenGetDescriptionIsCalled() { var expectedDescription = "Small Pizza"; var smallPizza = new SmallPizza(); var actualDescription = smallPizza.GetDescription(); actualDescription.Should().Be(expectedDescription); }
public void ReturnCost_WhenGetCostIsCalled() { var expectedCost = 5.0; var smallPizza = new SmallPizza(); var actualCost = smallPizza.GetCost(); actualCost.Should().Be(expectedCost); }
public void CreateSmallPizza_WhenCreatePizzaWithSizeSmallIsCalled() { var expectedPizza = new SmallPizza(); var customPizza = new PizzaBuilder(); customPizza.CreatePizzaWithSize(Size.Small); var actualPizza = customPizza.Bake(); actualPizza.Should().BeEquivalentTo(expectedPizza); }
public void ReturnSmallPizzaWithStandardCrustCost_WhenGetCostIsCalled() { var expectedCost = 5.0; var smallPizza = new SmallPizza(); var crustDecorator = new CrustDecorator(smallPizza, Crusts.Classic); var actualCost = crustDecorator.GetCost(); actualCost.Should().Be(expectedCost); }
public void ReturnSmallPizzaWithOneTierOneToppingCost_WhenGetCostIsCalled() { var expectedCost = 5.25; var smallPizza = new SmallPizza(); var toppingDecorator = new ToppingDecorator(smallPizza, Toppings.BlackOlives); var actualCost = toppingDecorator.GetCost(); actualCost.Should().Be(expectedCost); }
public void ReturnSmallPizzaWithStandardSauceCost_WhenGetCostIsCalled() { var expectedCost = 5.25; var smallPizza = new SmallPizza(); var crustDecorator = new SauceDecorator(smallPizza, Sauces.Tomato); var actualCost = crustDecorator.GetCost(); actualCost.Should().Be(expectedCost); }
public void ReturnSmallPizzaWithCrustDescription_WhenGetDescriptionIsCalled() { var expectedDescription = "Small Pizza\r\n\t- Classic crust"; var smallPizza = new SmallPizza(); var crustDecorator = new CrustDecorator(smallPizza, Crusts.Classic); var actualDescription = crustDecorator.GetDescription(); actualDescription.Should().Be(expectedDescription); }
public void ReturnSmallPizzaWithSauceDescription_WhenGetDescriptionIsCalled() { var expectedDescription = "Small Pizza\r\n\t- Tomato sauce"; var smallPizza = new SmallPizza(); var sauceDecorator = new SauceDecorator(smallPizza, Sauces.Tomato); var actualDescription = sauceDecorator.GetDescription(); actualDescription.Should().Be(expectedDescription); }
public void ReturnSmallPizzaWithSpecialSauceCost_WhenGetCostIsCalled() { var expectedCost = 5.5; var smallPizza = new SmallPizza(); var crustDecorator = new SauceDecorator(smallPizza, Sauces.Barbecue); var actualCost = crustDecorator.GetCost(); actualCost.Should().Be(expectedCost); }
public void ReturnSmallPizzaWithOneTierTwoToppingCost_WhenGetCostIsCalled() { var expectedCost = 5.5; var smallPizza = new SmallPizza(); var toppingDecorator = new ToppingDecorator(smallPizza, Toppings.SmokedBacon); var actualCost = toppingDecorator.GetCost(); actualCost.Should().Be(expectedCost); }
public void ReturnSmallPizzaWithSpecialCrustCost_WhenGetCostIsCalled() { var expectedCost = 6.0; var smallPizza = new SmallPizza(); var crustDecorator = new CrustDecorator(smallPizza, Crusts.Stuffed); var actualCost = crustDecorator.GetCost(); actualCost.Should().Be(expectedCost); }
public void CalculateCost_Returns_3() { //Arrange var smallPizza = new SmallPizza(); //Act var cost = smallPizza.CalculateCost(); //Assert Assert.AreEqual(cost, 3.00); }
public void ReturnSmallPizzaWithTwoTierOneToppingsCost_WhenGetCostIsCalled() { var expectedCost = 5.5; var smallPizza = new SmallPizza(); var toppingDecoratorOne = new ToppingDecorator(smallPizza, Toppings.BlackOlives); var toppingDecoratorTwo = new ToppingDecorator(toppingDecoratorOne, Toppings.Mushrooms); var actualCost = toppingDecoratorTwo.GetCost(); actualCost.Should().Be(expectedCost); }
public void ReturnSmallPizzaWithOneToppingDescription_WhenGetDescriptionIsCalled() { var expectedToppingDescription = Toppings.SmokedBacon; var expectedDescription = $"Small Pizza\r\n\t- {expectedToppingDescription}"; var smallPizza = new SmallPizza(); var toppingDecorator = new ToppingDecorator(smallPizza, expectedToppingDescription); var actualDescription = toppingDecorator.GetDescription(); actualDescription.Should().Be(expectedDescription); }
public void GetDescription_Returns_SmallPizza() { //Arrange var smallPizza = new SmallPizza(); //Act var description = smallPizza.GetDescription(); //Assert Assert.AreEqual(description, "Small Pizza"); }
public void CreateSmallPizzaWithSauce_WhenWithSauceIsCalled() { var sauce = Sauces.Tomato; var smallPizza = new SmallPizza(); var expectedPizza = new SauceDecorator(smallPizza, sauce); var customPizza = new PizzaBuilder(); customPizza.CreatePizzaWithSize(Size.Small) .WithSauce(sauce); var actualPizza = customPizza.Bake(); actualPizza.Should().BeEquivalentTo(expectedPizza); }
static void Main(string[] args) { Pizza smallPizza = new SmallPizza(); Console.WriteLine($"{smallPizza.Name} - {smallPizza.Price} ron"); Pizza mediumPizza = new MediumPizza(); Console.WriteLine($"{mediumPizza.Name} - {mediumPizza.Price} ron"); Pizza largePizza = new LargePizza(); Console.WriteLine($"{largePizza.Name} - {largePizza.Price} ron"); }
public void ReturnSmallPizzaWithTwoToppingsDescription_WhenGetDescriptionIsCalled() { var expectedFirstToppingDescription = Toppings.SmokedBacon; var expectedSecondToppingDescription = Toppings.Mushrooms; var expectedDescription = $"Small Pizza\r\n\t- {expectedFirstToppingDescription}\r\n\t- {expectedSecondToppingDescription}"; var smallPizza = new SmallPizza(); var toppingDecoratorOne = new ToppingDecorator(smallPizza, expectedFirstToppingDescription); var toppingDecoratorTwo = new ToppingDecorator(toppingDecoratorOne, expectedSecondToppingDescription); var actualDescription = toppingDecoratorTwo.GetDescription(); actualDescription.Should().Be(expectedDescription); }
public void CanGetTheCurrentPriceOfPizza() { SmallPizza smallPizza = new SmallPizza(); smallPizza.AddTopping(new Mushrooms()); Assert.AreEqual(990, smallPizza.Price()); MediumPizza mediumPizza = new MediumPizza(); mediumPizza.AddTopping(new Mushrooms()); Assert.AreEqual(1725, mediumPizza.Price()); LargePizza largePizza = new LargePizza(); largePizza.AddTopping(new Mushrooms()); Assert.AreEqual(2124, largePizza.Price()); }
public void TopingsCanBeAdded() { SmallPizza smallPizza = new SmallPizza(); smallPizza.AddTopping(new Mushrooms()); Assert.Pass(); MediumPizza mediumPizza = new MediumPizza(); mediumPizza.AddTopping(new Mushrooms()); Assert.Pass(); LargePizza largePizza = new LargePizza(); largePizza.AddTopping(new Mushrooms()); Assert.Pass(); }
public void CreateSmallPizzaWithOneTopping_WhenWithToppingIsCalledOnce() { var sauce = Sauces.Tomato; var crust = Crusts.Classic; var topping = Toppings.Mozzarella; var smallPizza = new SmallPizza(); var smallPizzaWithSauce = new SauceDecorator(smallPizza, sauce); var smallPizzaWithSauceAndCrust = new CrustDecorator(smallPizzaWithSauce, crust); var expectedPizza = new ToppingDecorator(smallPizzaWithSauceAndCrust, topping); var customPizza = new PizzaBuilder(); customPizza.CreatePizzaWithSize(Size.Small) .WithSauce(sauce) .WithCrust(crust) .AddTopping(topping); var actualPizza = customPizza.Bake(); actualPizza.Should().BeEquivalentTo(expectedPizza); }
static void Main(string[] args) { Pizza newPizza = new Pizza("crunchy"); // newPizza.Crust = "crunchy"; newPizza.Diameter = 12; Console.WriteLine(newPizza.PizzaArea()); Console.WriteLine(newPizza.InStock); newPizza.PizzaIsOutofStock(); Console.WriteLine(newPizza.InStock); // SmallPizza sp = new SmallPizza("soft"); Pizza sp = new SmallPizza("soft"); Console.WriteLine(sp.PizzaArea()); sp.PizzaIsOutofStock(); Console.WriteLine(sp.InStock); //Console.WriteLine("Hello World! "+Calculator.Add(5,6)); }