예제 #1
0
        public Dish Post([FromBody] DishParameters dish)
        {
            InitializeDishes initializeDishes = new InitializeDishes();

            //DishParameters dish =   JsonConvert.DeserializeObject<DishParameters>(value);
            Appetizer appetizer = initializeDishes.InitializeAppetizer(dish.Name, dish.Quantity, dish.DinerSerialNumber, eAppetizerTypes.ChickenSkewers);

            return(appetizer);
        }
        public void SelectMainDishToDB()
        {
            MainDish mainDish = InitializeDishes.InitializeMainDish("ChickenBreast", 2, 1, eMainDish.ChickenBreast);

            mainDish.Price = 70;
            Broker broker = new Broker();
            string name   = broker.Select(mainDish);

            Assert.AreEqual("ChickenBreast", name);
        }
        public void UpdateMainDishToDB()
        {
            MainDish mainDish = InitializeDishes.InitializeMainDish("ChickenBreast", 2, 1, eMainDish.ChickenBreast);

            mainDish.Price = 42;
            Broker broker = new Broker();

            broker.Update(mainDish);

            Assert.AreEqual(eAppetizer.ChickenNuggets, eAppetizer.ChickenNuggets);
        }
        public void AddMainDishToDB()
        {
            MainDish mainDish = InitializeDishes.InitializeMainDish("chicken", 2, 1, eMainDish.ChickenBreast);

            mainDish.Price = 30;
            Broker broker = new Broker();

            broker.Insert(mainDish);

            Assert.AreEqual(eAppetizer.ChickenNuggets, eAppetizer.ChickenNuggets);
        }
        public void InitializeMainDish_SpringChicken()
        {
            string    name              = "Spring Chicken";
            int       quantity          = 2;
            int       dinerSerialNumber = 1;
            eMainDish mainDishType      = eMainDish.SpringChicken;
            MainDish  mainDish          = InitializeDishes.InitializeMainDish(name, quantity, dinerSerialNumber, mainDishType);

            Assert.AreEqual(mainDishType, mainDish.MainDishType);
            Assert.AreEqual(dinerSerialNumber, mainDish.DinerSerialNumber);
            Assert.AreEqual(DishRanks.DishesRank[eDishTypes.MainDish], mainDish.MainRank);
            Assert.AreEqual(name, mainDish.Name);
            Assert.AreEqual(DishPrices.MainDishPrices[mainDishType], mainDish.Price);
            Assert.AreEqual(quantity, mainDish.Quantity);
            Assert.AreEqual(1, mainDish.SecondRank);
            Assert.AreEqual(DishRanks.MainDishRanks[mainDishType], mainDish.ThirdRank);
        }
예제 #6
0
        public void InitializeAppetizer_ChickenWings()
        {
            string     name              = "Chicken Wings";
            int        quantity          = 2;
            int        dinerSerialNumber = 1;
            eAppetizer appetizerType     = eAppetizer.ChickenWings;
            Appetizer  appetizer         = InitializeDishes.InitializeAppetizer(name, quantity, dinerSerialNumber, appetizerType);

            Assert.AreEqual(appetizerType, appetizer.AppetizerType);
            Assert.AreEqual(dinerSerialNumber, appetizer.DinerSerialNumber);
            Assert.AreEqual(DishRanks.DishesRank[eDishTypes.Appetizer], appetizer.MainRank);
            Assert.AreEqual(name, appetizer.Name);
            Assert.AreEqual(DishPrices.AppetizerPrices[appetizerType], appetizer.Price);
            Assert.AreEqual(quantity, appetizer.Quantity);
            Assert.AreEqual(1, appetizer.SecondRank);
            Assert.AreEqual(DishRanks.AppetizerRanks[appetizerType], appetizer.ThirdRank);
        }
예제 #7
0
        public void OrderTests_SortOrder()
        {
            Order order = new Order();

            string    name              = "Spring Chicken";
            int       quantity          = 2;
            int       dinerSerialNumber = 1;
            eMainDish mainDishType      = eMainDish.SpringChicken;
            MainDish  mainDish2         = InitializeDishes.InitializeMainDish(name, quantity, dinerSerialNumber, mainDishType);

            order.Dishes.Add(mainDish2);


            name              = "Chicken Nuggets";
            quantity          = 2;
            dinerSerialNumber = 1;
            eAppetizer appetizerType = eAppetizer.ChickenNuggets;
            Appetizer  appetizer     = InitializeDishes.InitializeAppetizer(name, quantity, dinerSerialNumber, appetizerType);

            order.Dishes.Add(appetizer);

            name              = "Schnitzel";
            quantity          = 2;
            dinerSerialNumber = 1;
            mainDishType      = eMainDish.Schnitzel;
            MainDish mainDish = InitializeDishes.InitializeMainDish(name, quantity, dinerSerialNumber, mainDishType);

            order.Dishes.Add(mainDish);

            name              = "Chicken Skewers";
            quantity          = 2;
            dinerSerialNumber = 1;
            appetizerType     = eAppetizer.ChickenSkewers;
            Appetizer appetizer2 = InitializeDishes.InitializeAppetizer(name, quantity, dinerSerialNumber, appetizerType);

            order.Dishes.Add(appetizer2);

            order.SortOrder();

            Assert.AreEqual(order.Dishes[0].Name, appetizer.Name);
            Assert.AreEqual(order.Dishes[1].Name, appetizer2.Name);
            Assert.AreEqual(order.Dishes[2].Name, mainDish.Name);
            Assert.AreEqual(order.Dishes[3].Name, mainDish2.Name);
        }
        public void InitializeAppetizer()
        {
            Appetizer appetizer = InitializeDishes.InitializeAppetizer("chicken", 2, 1, eAppetizer.ChickenNuggets);

            Assert.AreEqual(eAppetizer.ChickenNuggets, appetizer.AppetizerType);
        }