예제 #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")));
            }
        }
예제 #2
0
 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));
     }
 }
예제 #3
0
        public void ShouldHaveCorrectCaloriesWhenSweetIsTrueForSmall()
        {
            TyrannoTea tea = new TyrannoTea();

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

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

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

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

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

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

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

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

            t.HoldIce();
            Assert.False(t.Ice);
        }
예제 #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);
        }
예제 #13
0
        public void ShouldHaveCorrectPriceForSmall()
        {
            TyrannoTea tea = new TyrannoTea();

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

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

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

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

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

            Assert.PropertyChanged(tea, "Special", () =>
            {
                tea.HoldIce();
            });
        }
예제 #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);
        }
예제 #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);
        }
예제 #21
0
        public void ShouldHaveCorrectCaloriesWhenSweetIsTrueForLarge()
        {
            TyrannoTea tea = new TyrannoTea();

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

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

            Assert.PropertyChanged(tea, "Description", () =>
            {
                tea.Sweet = true;
            });
        }
예제 #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")));
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #27
0
        public void SpecialShouldAddLemon()
        {
            TyrannoTea tea = new TyrannoTea();

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

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

                                       );
        }
예제 #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);
        }
예제 #30
0
        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());
            }
        }