public void TyrannoTeaToStringShouldGiveNameForSizeAndSweetness(Size size, bool sweet) { Tyrannotea tea = new Tyrannotea(); tea.Size = size; tea.Sweet = sweet; if (sweet) { Assert.Equal($"{size} Sweet Tyrannotea", tea.ToString()); } else { Assert.Equal($"{size} Tyrannotea", tea.ToString()); } }
public void TyrannoTeaReturnsCorrectDescription(Size size, bool sweet) { Tyrannotea tea = new Tyrannotea(); tea.Size = size; tea.Sweet = sweet; if (sweet) { Assert.Equal($"{size} Sweet Tyrannotea", tea.Description); } else { Assert.Equal($"{size} Tyrannotea", tea.Description); } }
public void TyrannoTeaDescriptionShouldGiveNameForSizeAndSweetness(Size size, bool sweet) { Tyrannotea tea = new Tyrannotea(); tea.Size = size; tea.Sugar = sweet; if (sweet) { Assert.Equal($"{size} Sweet Tyrannotea", tea.Description); } else { Assert.Equal($"{size} Tyrannotea", tea.Description); } }
public void ShouldHaveCorrectSpecialCombined() { Tyrannotea tea = new Tyrannotea(); tea.HoldIce(); tea.AddLemon(); Assert.Collection <string>(tea.Special, item => { Assert.Equal("Hold Ice", item); }, item => { Assert.Equal("Add Lemon", item); }); }
public void DescriptionShouldBeCorrectForEachSize(Size size, bool sweet) { Tyrannotea tea = new Tyrannotea(); tea.Size = size; if (!sweet) { Assert.Equal($"{size} Tyrannotea", tea.Description); } else { tea.AddSweetener(); Assert.Equal($"{size} Sweet Tyrannotea", tea.Description); } }
public void HoldAllShouldAddtoSpecial() { Tyrannotea tea = new Tyrannotea(); tea.HoldIce(); tea.AddLemon(); Assert.Collection <string>(tea.Special, item => { Assert.Equal("Hold Ice", item); }, item => { Assert.Equal("Add Lemon", item); }); }
public void RemovingSweetenerDecreasesCalories() { Tyrannotea tea = new Tyrannotea(); tea.Sweet = true; tea.Sweet = false; Assert.Equal <uint>(8, tea.Calories); tea.Size = Size.Medium; Assert.Equal <uint>(16, tea.Calories); tea.Size = Size.Large; Assert.Equal <uint>(32, tea.Calories); }
public void SpecialShouldContainNeccessaryInstructions() { Tyrannotea t = new Tyrannotea(); t.HoldIce(); t.AddLemon(); Assert.Collection <string>(t.Special, item => { Assert.Equal("Hold Ice", item); }, item => { Assert.Equal("Add Lemon", item); }); }
public void ShouldListIngredientsLemonAndSweet() { Tyrannotea soda = new Tyrannotea(); soda.AddLemon(); soda.Sweet = true; List <string> ingredients = soda.Ingredients; Assert.Contains <string>("Water", ingredients); Assert.Contains <string>("Tea", ingredients); Assert.Contains <string>("Lemon", ingredients); Assert.Contains <string>("Cane Sugar", ingredients); Assert.Equal <int>(4, ingredients.Count); }
public void ComboSpecialShouldBeCorrect() { TRexKingBurger entreeOne = new TRexKingBurger(); entreeOne.HoldKetchup(); entreeOne.HoldLettuce(); CretaceousCombo combo = new CretaceousCombo(entreeOne); Assert.Equal("Hold Ketchup", combo.Special[1]); Assert.Equal("Hold Lettuce", combo.Special[0]); Assert.Equal("Small Fryceritops", combo.Special[2]); Assert.Equal("Small Cola Sodasaurus", combo.Special[3]); VelociWrap entreeTwo = new VelociWrap(); Tyrannotea drinkTwo = new Tyrannotea(); Triceritots sideTwo = new Triceritots(); entreeTwo.HoldDressing(); entreeTwo.HoldLettuce(); combo.Entree = entreeTwo; combo.Side = sideTwo; combo.Side.Size = Size.Large; drinkTwo.AddLemon(); combo.Drink = drinkTwo; Assert.Equal("Hold Dressing", combo.Special[0]); Assert.Equal("Hold Lettuce", combo.Special[1]); Assert.Equal("Large Triceritots", combo.Special[2]); Assert.Equal("Small Tyrannotea", combo.Special[3]); Assert.Equal("Add Lemon", combo.Special[4]); PrehistoricPBJ entreeThree = new PrehistoricPBJ(); Water drinkThree = new Water(); MeteorMacAndCheese sideThree = new MeteorMacAndCheese(); entreeThree.HoldJelly(); combo.Entree = entreeThree; combo.Side = sideThree; combo.Side.Size = Size.Medium; drinkThree.AddLemon(); drinkThree.HoldIce(); drinkThree.Size = Size.Medium; combo.Drink = drinkThree; Assert.Equal("Hold Jelly", combo.Special[0]); Assert.Equal("Medium Meteor Mac and Cheese", combo.Special[1]); Assert.Equal("Medium Water", combo.Special[2]); Assert.Equal("Add Lemon", combo.Special[3]); Assert.Equal("Hold Ice", combo.Special[4]); }
public void SizeChangeShouldCorrectlyChangePriceAndCalories() { Tyrannotea t = new Tyrannotea(); t.Size = Size.Medium; Assert.Equal(1.49, t.Price); Assert.Equal <uint>(16, t.Calories); t.Size = Size.Large; Assert.Equal(1.99, t.Price); Assert.Equal <uint>(32, t.Calories); t.Size = Size.Small; Assert.Equal(.99, t.Price); Assert.Equal <uint>(8, t.Calories); }
public void TyrannoteaPropertyChanges() { Tyrannotea tt = new Tyrannotea(); Assert.PropertyChanged(tt, "Sweet", () => tt.Sweet = true); Assert.PropertyChanged(tt, "Lemon", () => tt.Lemon = true); Assert.PropertyChanged(tt, "Special", () => tt.Lemon = true); Assert.PropertyChanged(tt, "Ice", () => tt.Ice = true); Assert.PropertyChanged(tt, "Special", () => tt.Ice = true); Assert.PropertyChanged(tt, "Size", () => tt.Size = Size.Large); Assert.PropertyChanged(tt, "Price", () => tt.Size = Size.Large); Assert.PropertyChanged(tt, "Calories", () => tt.Size = Size.Large); Assert.PropertyChanged(tt, "Description", () => tt.Size = Size.Large); Assert.PropertyChanged(tt, "Description", () => tt.Sweet = true); Assert.PropertyChanged(tt, "Calories", () => tt.Sweet = false); }
public void ShouldHoldIceAndAddLemonToSpecial() { Tyrannotea tyr = new Tyrannotea(); tyr.Ice = false; tyr.AddLemon(); Assert.Collection <string>(tyr.Special, item => { Assert.Equal("Hold Ice", item); }, item => { Assert.Equal("Add Lemon", item); }); }
public void AddLemonNotifies() { Tyrannotea s = new Tyrannotea(); Assert.PropertyChanged(s, "Special", () => { s.AddLemon(); } ); Assert.PropertyChanged(s, "Ingredients", () => { s.AddLemon(); } ); }
public void CorrectIngredientsAreGiven() { Tyrannotea tt = new Tyrannotea(); Assert.Contains <String>("Water", tt.Ingredients); Assert.Contains <String>("Tea", tt.Ingredients); Assert.DoesNotContain <String>("Lemon", tt.Ingredients); Assert.DoesNotContain <String>("Cane Sugar", tt.Ingredients); tt.AddLemon(); Assert.Contains <String>("Lemon", tt.Ingredients); /* * tt.Sweet = true; * Assert.Contains<String>("Cane Sugar", tt.Ingredients); */ }
public void CorrectIngredients() { Tyrannotea s = new Tyrannotea(); List <string> temp = s.Ingredients; Assert.Contains("Water", temp); Assert.Contains("Tea", temp); Assert.DoesNotContain("Cane Sugar", temp); Assert.DoesNotContain("Lemon", temp); s.Sweet = true; s.AddLemon(); temp.Clear(); temp = s.Ingredients; Assert.Contains("Cane Sugar", temp); Assert.Contains("Lemon", temp); }
public void SettingSweetToFalseResultsInProperCalories() { Tyrannotea tea = new Tyrannotea(); tea.Sweet = true; tea.Sweet = false; Assert.Equal <uint>(8, tea.Calories); tea.Size = Size.Medium; tea.Sweet = true; tea.Sweet = false; Assert.Equal <uint>(16, tea.Calories); tea.Size = Size.Large; tea.Sweet = true; tea.Sweet = false; Assert.Equal <uint>(32, tea.Calories); }
public void AddLemonAndHoldIceShouldAddToSpecial() { Tyrannotea tt = new Tyrannotea(); tt.AddLemon(); tt.HoldIce(); Assert.Collection <string>(tt.Special, item => { Assert.Equal("Add Lemon", item); }, item => { Assert.Equal("Hold Ice", item); }); }
/// <summary> /// Acts as changing button depending on if the object is soda, java, or tea /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChangingButton_Click(object sender, RoutedEventArgs e) { if (DataContext is Order order) { if (CollectionViewSource.GetDefaultView(order.Items).CurrentItem is DinoDiner.Menu.CretaceousCombo Combo) { if (Combo.Drink is DinoDiner.Menu.JurassicJava java) { JurassicJava j = new JurassicJava(); if (java.Decaf) { j.MakeUndecaf(); j.Size = Combo.Size; Combo.Drink = j; } else { j.MakeDecaf(); j.Size = Combo.Size; Combo.Drink = j; } } else if (Combo.Drink is DinoDiner.Menu.Sodasaurus soda) { this.NavigationService.Navigate(new ComboDrinkSideScreen.FlavorSelection()); } else if (Combo.Drink is DinoDiner.Menu.Tyrannotea tea) { Tyrannotea t = new Tyrannotea(); if (tea.Sweet) { t.MakeUnSweet(); t.Size = Combo.Size; Combo.Drink = t; } else { t.MakeSweet(); t.Size = Combo.Size; Combo.Drink = t; } } } CollectionViewSource.GetDefaultView(order.Items).Refresh(); } }
private void ButtonOnClick(object sender, RoutedEventArgs e) { if (sender is Button button && DataContext is Order order) { Drink drink; if (button.Name == App.ConvertToID(new JurassicJava().ToString())) { drink = new JurassicJava(); SelectingJurassicJava(); } else if (button.Name == App.ConvertToID(new Sodasaurus().ToString())) { drink = new Sodasaurus(); SelectingSodasaurus(); } else if (button.Name == App.ConvertToID(new Tyrannotea().ToString())) { drink = new Tyrannotea(); SelectingTyrannotea(); } else { drink = new Water(); SelectingWater(); } if ((bool)(Sizes.Children[1] as RadioButton).IsChecked) { drink.Size = DinoDiner.Menu.Size.Medium; } else if ((bool)(Sizes.Children[2] as RadioButton).IsChecked) { drink.Size = DinoDiner.Menu.Size.Large; } if (wasCombo && CollectionViewSource.GetDefaultView(order.Items).CurrentItem is CretaceousCombo combo) { combo.Drink = drink; } else { order.Items.Add(drink); CollectionViewSource.GetDefaultView(order.Items).MoveCurrentToLast(); } } }
public void TyrannoteaSpecialShouldGiveCorrectArrayForSpecials() { Tyrannotea t = new Tyrannotea(); t.AddLemon(); Assert.Contains <string>("Add Lemon", t.Special); t = new Tyrannotea(); t.HoldIce(); Assert.Contains <string>("Hold Ice", t.Special); t = new Tyrannotea(); t.AddLemon(); t.HoldIce(); Assert.Contains <string>("Hold Ice", t.Special); Assert.Contains <string>("Add Lemon", t.Special); }
public void CorrectIngredients() { Tyrannotea t = new Tyrannotea(); List <string> ingre = t.Ingredients; Assert.Contains <string>("Water", ingre); Assert.Contains <string>("Tea", ingre); Assert.Equal <int>(2, ingre.Count); t.Sweet = true; ingre = t.Ingredients; Assert.Contains <string>("Cane Sugar", ingre); Assert.Equal <int>(3, ingre.Count); t.Lemon = true; ingre = t.Ingredients; Assert.Contains <string>("Lemon", ingre); Assert.Equal <int>(4, ingre.Count); }
public void ChangingSizeShouldNotifyOfPropertyChange(string propertyName) { Tyrannotea drink = new Tyrannotea(); Assert.PropertyChanged(drink, propertyName, () => { drink.Size = Size.Medium; }); Assert.PropertyChanged(drink, propertyName, () => { drink.Size = Size.Large; }); Assert.PropertyChanged(drink, propertyName, () => { drink.Size = Size.Small; }); }
public void ChangeSizeShouldNotifyPriceAndCalories(Size size) { Tyrannotea tyr = new Tyrannotea(); Assert.PropertyChanged(tyr, "Price", () => { tyr.Size = size; }); Assert.PropertyChanged(tyr, "Calories", () => { tyr.Size = size; }); Assert.PropertyChanged(tyr, "Ingredients", () => { tyr.Size = size; }); }
public void SpecialShouldAddSweetenerAndHoldIce() { Tyrannotea tea = new Tyrannotea(); tea.AddSweetener(); tea.HoldIce(); Assert.Collection <string>(tea.Special, item => { Assert.Equal("Add Sweetener", item); }, item => { Assert.Equal("Hold Ice", item); } ); }
public void ShouldHaveCorrectDescription(Size size, bool sweet) { Tyrannotea t = new Tyrannotea { Size = size, Sweet = sweet }; if (sweet) { Assert.Equal($"{size} Sweet Tyrannotea", t.Description); } else { Assert.Equal($"{size} Tyrannotea", t.Description); } }
public void SubTotalCostShouldNeverBeNegative() { Order check = new Order(); Tyrannotea test1 = new Tyrannotea(); test1.Price = -2; Brontowurst test2 = new Brontowurst(); test2.Price = -2; Fryceritops test3 = new Fryceritops(); test3.Price = -2; check.Add(test1); check.Add(test2); check.Add(test3); Assert.True(Math.Abs(6 - check.SubTotalCost) < .00000001); }
public void SizeChangeShouldNotifyPropertyChange(string propertyName) { Tyrannotea t = new Tyrannotea(); Assert.PropertyChanged(t, propertyName, () => { t.Size = Size.Medium; }); Assert.PropertyChanged(t, propertyName, () => { t.Size = Size.Large; }); Assert.PropertyChanged(t, propertyName, () => { t.Size = Size.Small; }); }
public void ShouldHaveCorrectIngredients() { Tyrannotea tea = new Tyrannotea(); Assert.Contains <string>("Water", tea.Ingredients); Assert.Contains <string>("Tea", tea.Ingredients); tea.AddLemon(); tea.Sweet = true; if (tea.Lemon) { Assert.Contains <string>("Lemon", tea.Ingredients); } if (tea.Sweet) { Assert.Contains <string>("Cane Sugar", tea.Ingredients); } }
public void ShouldHaveHoldIceAndAddLemonWhenHoldingIceAndAddingLemon() { Tyrannotea tea = new Tyrannotea(); tea.HoldIce(); tea.AddLemon(); Assert.Collection(tea.Special, item => { Assert.Equal("Hold Ice", item); }, item => { Assert.Equal("Add Lemon", item); } ); }