Example #1
0
        public void CombosOfOptionsWork(bool holdIce, bool addLemon)
        {
            TyrannoTea t = new TyrannoTea();

            if (holdIce)
            {
                t.HoldIce();
            }
            if (addLemon)
            {
                t.AddLemon();
            }
            if (holdIce)
            {
                Assert.True(Array.Exists <string>(t.Special, element => element.Equals("Hold Ice")));
            }
            if (addLemon)
            {
                Assert.True(Array.Exists <string>(t.Special, element => element.Equals("Add Lemon")));
            }
            if (!holdIce)
            {
                Assert.False(Array.Exists <string>(t.Special, element => element.Equals("Hold Ice")));
            }
            if (!addLemon)
            {
                Assert.False(Array.Exists <string>(t.Special, element => element.Equals("Add Lemon")));
            }
        }
 public void ClickSpecial1(object sender, RoutedEventArgs e)
 {
     if (combo != null && combo.Drink is TyrannoTea)
     {
         TyrannoTea t = combo.Drink as TyrannoTea;
         t.Sweet = true;
     }
     if (d != null && d is TyrannoTea)
     {
         TyrannoTea t = d as TyrannoTea;
         t.Sweet = true;
     }
     if (d != null && d is JurassicJava)
     {
         JurassicJava j = d as JurassicJava;
         j.Decaf = true;
     }
     if (combo != null && combo.Drink is JurassicJava)
     {
         JurassicJava j = d as JurassicJava;
         j.Decaf = true;
     }
     if (combo != null && combo.Drink is Sodasaurus)
     {
         NavigationService.Navigate(new ChooseFlavor(combo));
     }
     if (d != null && d is Sodasaurus)
     {
         NavigationService.Navigate(new ChooseFlavor(d as Sodasaurus));
     }
 }
Example #3
0
        public void ShouldHaveCorrectCaloriesWhenSweetIsTrueForSmall()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.AddSweet();
            Assert.Equal <uint>(2 * 8, tea.Calories);
        }
Example #4
0
        public void ShouldHaveCorrectPriceForMedium()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Size = Size.Medium;
            Assert.Equal <double>(1.49, tea.Price);
        }
Example #5
0
        public void ShouldHaveCorrectCaloriesForMedium()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Size = Size.Medium;
            Assert.Equal <uint>(16, tea.Calories);
        }
Example #6
0
        public void ShouldHaveCorrectWhenCallingHoldIce()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.HoldIce();
            Assert.False(tea.Ice);
        }
Example #7
0
        public void ShouldHaveCorrectWhenCallingAddLemon()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.AddLemon();
            Assert.True(tea.Lemon);
        }
Example #8
0
        public void ShouldHaveCorrectCaloriesForLarge()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Size = Size.Large;
            Assert.Equal <uint>(32, tea.Calories);
        }
Example #9
0
        public void ShouldHaveCorrectPriceForLarge()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Size = Size.Large;
            Assert.Equal <double>(1.99, tea.Price);
        }
Example #10
0
        public void CorrectAddLemon()
        {
            TyrannoTea t = new TyrannoTea();

            t.AddLemon();
            Assert.True(t.Lemon);
        }
Example #11
0
        public void CorrectHeldIce()
        {
            TyrannoTea t = new TyrannoTea();

            t.HoldIce();
            Assert.False(t.Ice);
        }
Example #12
0
        public void ShouldHaveCorrectIngedients()
        {
            TyrannoTea tea = new TyrannoTea();

            Assert.Contains <string>("Water", tea.Ingredients);
            Assert.Contains <string>("Tea", tea.Ingredients);
            Assert.Equal <int>(2, tea.Ingredients.Count);
        }
Example #13
0
        public void ShouldHaveCorrectPriceForSmall()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Size = Size.Medium;
            tea.Size = Size.Small;
            Assert.Equal <double>(0.99, tea.Price);
        }
Example #14
0
        public void ShouldHaveCorrectCaloriesWhenSweetIsFalseForSmall()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Sweet = true;
            tea.Sweet = false;
            Assert.Equal <uint>(8, tea.Calories);
        }
Example #15
0
        public void AddSweetNotifyOfSpecialPropertyChanged()
        {
            TyrannoTea tea = new TyrannoTea();

            Assert.PropertyChanged(tea, "Calories", () =>
            {
                tea.AddSweet();
            });
        }
Example #16
0
        public void TyrannoteaSizeChangeShouldNotifyProperty(Size size, string property)
        {
            TyrannoTea tea = new TyrannoTea();

            Assert.PropertyChanged(tea, property, () =>
            {
                tea.Size = size;
            });
        }
Example #17
0
        public void TyrannoteaAddLemonShouldNotifyPropertyChanged()
        {
            TyrannoTea tea = new TyrannoTea();

            Assert.PropertyChanged(tea, "Special", () =>
            {
                tea.AddLemon();
            });
        }
Example #18
0
        public void TyrannoteaHoldIceShouldNotifySpecialPropertyChanged()
        {
            TyrannoTea tea = new TyrannoTea();

            Assert.PropertyChanged(tea, "Special", () =>
            {
                tea.HoldIce();
            });
        }
Example #19
0
        public void ShouldHaveCorrectCaloriesWhenSweetIsFalseForMedium()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Sweet = true;
            tea.Sweet = false;
            tea.Size  = Size.Medium;
            Assert.Equal <uint>(16, tea.Calories);
        }
Example #20
0
        public void ShouldHaveCorrectCaloriesWhenSweetIsFalseForLarge()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Sweet = true;
            tea.Sweet = false;
            tea.Size  = Size.Large;
            Assert.Equal <uint>(32, tea.Calories);
        }
Example #21
0
        public void ShouldHaveCorrectCaloriesWhenSweetIsTrueForLarge()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Size = Size.Large;
            tea.AddSweet();

            Assert.Equal <uint>(2 * 32, tea.Calories);
        }
Example #22
0
        public void TyrannoteaSetSweetShouldNotifyPropertyDescription()
        {
            TyrannoTea tea = new TyrannoTea();

            Assert.PropertyChanged(tea, "Description", () =>
            {
                tea.Sweet = true;
            });
        }
Example #23
0
        public void IndividualHoldsWork()
        {
            TyrannoTea t = new TyrannoTea();

            t.HoldIce();
            Assert.True(Array.Exists <string>(t.Special, element => element.Equals("Hold Ice")));
            t = new TyrannoTea();
            t.AddLemon();
            Assert.True(Array.Exists <string>(t.Special, element => element.Equals("Add Lemon")));
        }
Example #24
0
        public void ShouldHaveCorrectIngedientsForWhenLemonIsTrue()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.AddLemon();
            Assert.Contains <string>("Water", tea.Ingredients);
            Assert.Contains <string>("Tea", tea.Ingredients);
            Assert.Contains <string>("Lemon", tea.Ingredients);
            Assert.Equal <int>(3, tea.Ingredients.Count);
        }
Example #25
0
        public void ShouldHaveCorrectIngedientsForWhenSweetIsTrue()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.Sweet = true;
            Assert.Contains <string>("Water", tea.Ingredients);
            Assert.Contains <string>("Tea", tea.Ingredients);
            Assert.Contains <string>("Cane Sugar", tea.Ingredients);
            Assert.Equal <int>(3, tea.Ingredients.Count);
        }
Example #26
0
        public void CorrectDefaults()
        {
            TyrannoTea t = new TyrannoTea();

            Assert.Equal <Size>(Size.Small, t.Size);
            Assert.Equal <uint>(8, t.Calories);
            Assert.Equal <double>(0.99, t.Price);
            Assert.False(t.Lemon);
            Assert.True(t.Ice);
        }
Example #27
0
        public void SpecialShouldAddLemon()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.AddLemon();
            Assert.Collection <string>(tea.Special,
                                       item =>
            {
                Assert.Equal("Add Lemon", item);
            }
                                       );
        }
Example #28
0
        public void SpecialShouldHoldIce()
        {
            TyrannoTea tea = new TyrannoTea();

            tea.HoldIce();
            Assert.Collection <string>(tea.Special,
                                       item =>
            {
                Assert.Equal("Hold Ice", item);
            }

                                       );
        }
Example #29
0
        public void CheckIngredients()
        {
            TyrannoTea    t = new TyrannoTea();
            List <string> l = new List <string>();

            l.Add("Water");
            l.Add("Tea");
            Assert.Equal <List <string> >(l, t.Ingredients);
            t.AddLemon();
            l.Add("Lemon");
            Assert.Equal <List <string> >(l, t.Ingredients);
            t.Sweet = true;
            l.Add("Cane Sugar");
            Assert.Equal <List <string> >(l, t.Ingredients);
        }
        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());
            }
        }