コード例 #1
0
        public void ShouldHaveCorrectSpecial()
        {
            SteakosaurusBurger s = new SteakosaurusBurger();

            s.HoldBun();
            Assert.Collection(s.Special, item =>
            {
                Assert.Equal("Hold Bun", item);
            });
            s.bun = true;
            s.HoldKetchup();
            Assert.Collection(s.Special, item =>
            {
                Assert.Equal("Hold Ketchup", item);
            });
            s.ketchup = true;
            s.HoldMustard();
            Assert.Collection(s.Special, item =>
            {
                Assert.Equal("Hold Mustard", item);
            });
            s.mustard = true;
            s.HoldPickle();
            Assert.Collection(s.Special, item =>
            {
                Assert.Equal("Hold Pickle", item);
            });
            s.HoldBun();
            s.HoldKetchup();
            s.HoldMustard();
            string[] specials = new string[] { "Hold Bun", "Hold Pickle", "Hold Ketchup", "Hold Mustard" };
            Assert.Equal(s.Special, specials);
        }
コード例 #2
0
ファイル: IOrderItemTest.cs プロジェクト: Brockka/dino-diner
        public void MultipleSteakosaurusBurgerSpecialShouldChange(string ans1, string ans2, string ans3)
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            if (ans1 == "Hold Ketchup")
            {
                sb.HoldKetchup();
            }
            if (ans1 == "Hold Whole Wheat Bun")
            {
                sb.HoldBun();
            }
            if (ans1 == "Hold Pickle")
            {
                sb.HoldPickle();
            }
            if (ans1 == "Hold Mustard")
            {
                sb.HoldMustard();
            }
            if (ans2 == "Hold Ketchup")
            {
                sb.HoldKetchup();
            }
            if (ans2 == "Hold Whole Wheat Bun")
            {
                sb.HoldBun();
            }
            if (ans2 == "Hold Pickle")
            {
                sb.HoldPickle();
            }
            if (ans2 == "Hold Mustard")
            {
                sb.HoldMustard();
            }
            if (ans3 == "Hold Ketchup")
            {
                sb.HoldKetchup();
            }
            if (ans3 == "Hold Whole Wheat Bun")
            {
                sb.HoldBun();
            }
            if (ans3 == "Hold Pickle")
            {
                sb.HoldPickle();
            }
            if (ans3 == "Hold Mustard")
            {
                sb.HoldMustard();
            }
            Assert.Contains(ans1, sb.Special);
            Assert.Contains(ans2, sb.Special);
            Assert.Contains(ans3, sb.Special);
        }
コード例 #3
0
        public void HoldbunShouldNotifyofSpecialPropertyChange()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            Assert.PropertyChanged(sb, "Special", () =>
            {
                sb.HoldBun();
            });
        }
コード例 #4
0
        public void CheckPropertyChangedSteakosaurusBurger()
        {
            SteakosaurusBurger ft = new SteakosaurusBurger();

            Assert.PropertyChanged(ft, "Price", () => ft.Price *= 2);
            Assert.PropertyChanged(ft, "Bun", () => ft.HoldBun());
            Assert.PropertyChanged(ft, "Pickle", () => ft.HoldPickle());
            Assert.PropertyChanged(ft, "Mustard", () => ft.HoldMustard());
            Assert.PropertyChanged(ft, "Ketchup", () => ft.HoldKetchup());
            Assert.PropertyChanged(ft, "Special", () => ft.HoldBun());
        }
コード例 #5
0
        public void HoldingBunShouldNotifySpecialAndIngredients()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            Assert.PropertyChanged(sb, "Special", () =>
            {
                sb.HoldBun();
            });
            Assert.PropertyChanged(sb, "Ingredients", () =>
            {
                sb.HoldBun();
            });
        }
コード例 #6
0
        public void PropertyShouldChangeSteakosaurusBurger()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            Assert.PropertyChanged(sb, "Ingredients", () => sb.HoldBun());
            Assert.PropertyChanged(sb, "Ingredients", () => sb.HoldPickle());
            Assert.PropertyChanged(sb, "Ingredients", () => sb.HoldKetchup());
            Assert.PropertyChanged(sb, "Ingredients", () => sb.HoldMustard());
            Assert.PropertyChanged(sb, "Special", () => sb.HoldBun());
            Assert.PropertyChanged(sb, "Special", () => sb.HoldPickle());
            Assert.PropertyChanged(sb, "Special", () => sb.HoldKetchup());
            Assert.PropertyChanged(sb, "Special", () => sb.HoldMustard());
        }
コード例 #7
0
 /// <summary>
 /// Holds the bun when selected
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void SelectHoldBun(object sender, RoutedEventArgs args)
 {
     if (isCombo)
     {
         if (Combo.Entree is SteakosaurusBurger sb)
         {
             sb.HoldBun();
             Combo.NotifyOfPropertyChange("Special");
         }
     }
     else
     {
         sb.HoldBun();
     }
 }
コード例 #8
0
 private void OnHoldBun(object sender, RoutedEventArgs args)
 {
     if (sb != null)
     {
         sb.HoldBun();
     }
     else if (combo != null)
     {
         if (combo.Entree is SteakosaurusBurger sb)
         {
             sb.HoldBun();
             combo.Entree = sb;
         }
     }
 }
コード例 #9
0
        public void SteakosaurusBurgerSpecialPropertiesShouldWorkProperly()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            Assert.Empty(sb.Special);

            sb.HoldBun();
            Assert.Contains <string>("Hold Bun", sb.Special);

            sb = new SteakosaurusBurger();
            sb.HoldKetchup();
            Assert.Contains <string>("Hold Ketchup", sb.Special);

            sb = new SteakosaurusBurger();
            sb.HoldMustard();
            Assert.Contains <string>("Hold Mustard", sb.Special);

            sb = new SteakosaurusBurger();
            sb.HoldPickle();
            Assert.Contains <string>("Hold Pickle", sb.Special);

            sb = new SteakosaurusBurger();
            sb.HoldBun();
            sb.HoldKetchup();
            sb.HoldMustard();
            sb.HoldPickle();
            Assert.Contains <string>("Hold Bun", sb.Special);
            Assert.Contains <string>("Hold Ketchup", sb.Special);
            Assert.Contains <string>("Hold Mustard", sb.Special);
            Assert.Contains <string>("Hold Pickle", sb.Special);
        }
コード例 #10
0
        public void SpecialShouldHoldKetchupAndMustardAndBunAndPickle()
        {
            SteakosaurusBurger s = new SteakosaurusBurger();

            s.HoldKetchup();
            s.HoldMustard();
            s.HoldBun();
            s.HoldPickle();
            Assert.Collection <string>(s.Special, item =>
            {
                Assert.Equal("Hold Ketchup", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Mustard", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Bun", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Pickle", item);
            });
        }
コード例 #11
0
        public void IndividualSpecialTest()
        {
            SteakosaurusBurger bun = new SteakosaurusBurger();

            bun.HoldBun();
            Assert.Contains("Hold Bun", bun.Special);
            Assert.Single(bun.Special);

            SteakosaurusBurger pickle = new SteakosaurusBurger();

            pickle.HoldPickle();
            Assert.Contains("Hold Pickle", pickle.Special);
            Assert.Single(pickle.Special);

            SteakosaurusBurger ketchup = new SteakosaurusBurger();

            ketchup.HoldKetchup();
            Assert.Contains("Hold Ketchup", ketchup.Special);
            Assert.Single(ketchup.Special);

            SteakosaurusBurger mustard = new SteakosaurusBurger();

            mustard.HoldMustard();
            Assert.Contains("Hold Mustard", mustard.Special);
            Assert.Single(mustard.Special);
        }
コード例 #12
0
        public void SpecialShouldHaveHoldAllCondiments()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            sb.HoldPickle();
            sb.HoldKetchup();
            sb.HoldMustard();
            Assert.Collection <string>(sb.Special,
                                       item =>
            {
                Assert.Equal("Hold Whole Wheat Bun", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Pickle", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Ketchup", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Mustard", item);
            });
        }
コード例 #13
0
        public void HoldBunShouldRemoveBun()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            Assert.DoesNotContain <string>("Whole Wheat Bun", sb.Ingredients);
        }
コード例 #14
0
        public void SteakosaurusSpecialShouldGiveCorrectArrayForThreeSpecials()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            sb.HoldKetchup();
            sb.HoldMustard();
            Assert.Contains <string>("Hold Bun", sb.Special);
            Assert.Contains <string>("Hold Ketchup", sb.Special);
            Assert.Contains <string>("Hold Mustard", sb.Special);

            sb = new SteakosaurusBurger();
            sb.HoldBun();
            sb.HoldKetchup();
            sb.HoldPickle();
            Assert.Contains <string>("Hold Bun", sb.Special);
            Assert.Contains <string>("Hold Ketchup", sb.Special);
            Assert.Contains <string>("Hold Pickle", sb.Special);

            sb = new SteakosaurusBurger();
            sb.HoldBun();
            sb.HoldPickle();
            sb.HoldMustard();
            Assert.Contains <string>("Hold Bun", sb.Special);
            Assert.Contains <string>("Hold Pickle", sb.Special);
            Assert.Contains <string>("Hold Mustard", sb.Special);

            sb = new SteakosaurusBurger();
            sb.HoldPickle();
            sb.HoldKetchup();
            sb.HoldMustard();
            Assert.Contains <string>("Hold Pickle", sb.Special);
            Assert.Contains <string>("Hold Ketchup", sb.Special);
            Assert.Contains <string>("Hold Mustard", sb.Special);
        }
コード例 #15
0
        public void SteakosaurusBugerNotifyPropertyChanged()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            Assert.PropertyChanged(sb, "Price", () =>
            {
                sb.Price = 10;
            });
            Assert.PropertyChanged(sb, "Calories", () =>
            {
                sb.Calories = 10;
            });

            System.Action[] actions =
            {
                () => { sb.HoldBun();     },
                () => { sb.HoldPickle();  },
                () => { sb.HoldKetchup(); },
                () => { sb.HoldMustard(); },
            };
            string[] properties = { "Special", "Ingredients" };

            foreach (System.Action action in actions)
            {
                foreach (string property in properties)
                {
                    Assert.PropertyChanged(sb, property, action);
                }
            }
        }
コード例 #16
0
        public void SpecialShouldHoldAll()
        {
            SteakosaurusBurger bw = new SteakosaurusBurger();

            bw.HoldBun();
            bw.HoldKetchup();
            bw.HoldPickle();
            bw.HoldMustard();
            Assert.Collection <string>(bw.Special,
                                       item =>
            {
                Assert.Equal("Hold Whole Wheat Bun", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Pickle", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Ketchup", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Mustard", item);
            }
                                       );
        }
コード例 #17
0
        public void HoldBunShouldChangeSpecialBun()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            Assert.Contains <string>("Hold Whole Wheat Bun", sb.Special);
        }
コード例 #18
0
        public void HoldAllShouldAddToSpecial()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            sb.HoldPickle();
            sb.HoldKetchup();
            sb.HoldMustard();
            Assert.Collection <string>(sb.Special,
                                       item =>
            {
                Assert.Equal("Hold Whole Wheat Bun", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Pickle", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Ketchup", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Mustard", item);
            });
            //Have to have in correct order to be able to pass test
        }
コード例 #19
0
        public void ShouldHaveHoldBunAndHoldPickleAndHoldMustardAndHoldKetchupWhenHoldingBunAndPickleAndMustardAndKetchup()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            sb.HoldPickle();
            sb.HoldMustard();
            sb.HoldKetchup();
            Assert.Collection(sb.Special,
                              item =>
            {
                Assert.Equal("Hold Bun", item);
            },
                              item =>
            {
                Assert.Equal("Hold Pickle", item);
            },
                              item =>
            {
                Assert.Equal("Hold Ketchup", item);
            },
                              item =>
            {
                Assert.Equal("Hold Mustard", item);
            }
                              );
        }
コード例 #20
0
 public void SteakosaurusBurgerPropertyChangesShouldWorkProperly() {
     SteakosaurusBurger sb = new SteakosaurusBurger();
     Assert.PropertyChanged(sb, "Special", () => sb.HoldBun());
     Assert.PropertyChanged(sb, "Special", () => sb.HoldKetchup());
     Assert.PropertyChanged(sb, "Special", () => sb.HoldMustard());
     Assert.PropertyChanged(sb, "Special", () => sb.HoldPickle());
 }
コード例 #21
0
        public void ShouldHaveCorrectSpecialAfterHoldingBun()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            Assert.Contains <string>("Hold Bun", sb.Special);
        }
コード例 #22
0
        public void HoldBunAddsHoldBunToSpecial()
        {
            SteakosaurusBurger entree = new SteakosaurusBurger();

            entree.HoldBun();
            Assert.Equal("Hold Bun", entree.Special[0]);
        }
コード例 #23
0
        public void HoldingBunShouldAddToSpecial()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            Assert.Contains("Hold Bun", sb.Special);
        }
コード例 #24
0
        public void ShouldHaveCorrectSpecialInstructions()
        {
            SteakosaurusBurger s  = new SteakosaurusBurger();
            Triceritots        t  = new Triceritots();
            Sodasaurus         ss = new Sodasaurus();

            s.HoldBun();
            s.HoldKetchup();
            t.MakeMedium();
            ss.HoldIce();
            CretaceousCombo c = new CretaceousCombo(s);

            c.Side  = t;
            c.Drink = ss;
            Assert.Collection <string>(c.Special, item =>
            {
                Assert.Equal("Hold Bun", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Ketchup", item);
            },
                                       item =>
            {
                Assert.Equal("Medium Triceritots", item);
            },
                                       item =>
            {
                Assert.Equal("Small Cola Sodasaurus", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Ice", item);
            });
        }
コード例 #25
0
 private void BunClick(object sender, RoutedEventArgs arsg)
 {
     if (DataContext is Order order)
     {
         sb.HoldBun();
     }
 }
コード例 #26
0
        public void HoldBunKetchupMusardMusardShoukdAddToSpecial()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            sb.HoldKetchup();
            sb.HoldPickle();
            sb.HoldMustard();
            Assert.Collection <string>(sb.Special, item =>
            {
                Assert.Equal("Hold Whole Wheat Bun", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Pickle", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Ketchup", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Mustard", item);
            });
        }
コード例 #27
0
        public void HoldAllShouldAddAllToSpecial()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            sb.HoldPickle();
            sb.HoldKetchup();
            sb.HoldMustard();
            Assert.Collection <string>(sb.Special, item =>
            {
                Assert.Equal("Hold Bun", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Pickles", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Ketchup", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Mustard", item);
            });
        }
コード例 #28
0
        public void holdBunNotifies()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            Assert.PropertyChanged(sb, "Special", () =>
            {
                sb.HoldBun();
            }
                                   );

            Assert.PropertyChanged(sb, "Ingredients", () =>
            {
                sb.HoldBun();
            }
                                   );
        }
コード例 #29
0
        public void SpecialShouldBeCorrectAfterHoldingManyThings()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldPickle();
            sb.HoldKetchup();
            sb.HoldMustard();
            sb.HoldBun();
            Assert.Collection <string>(sb.Special, item =>
            {
                Assert.Equal("Hold Pickle", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Mustard", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Ketchup", item);
            },
                                       item =>
            {
                Assert.Equal("Hold Whole-Wheat Bun", item);
            });
        }
コード例 #30
0
        public void SpecialShouldHaveHoldBun()
        {
            SteakosaurusBurger sb = new SteakosaurusBurger();

            sb.HoldBun();
            Assert.Collection <string>(sb.Special, item => { Assert.Equal("Hold Whole Wheat Bun", item); });
        }