Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public void InitializeAppetizer()
        {
            //Appetizer appetizer = initializeDishes.InitializeAppetizer("chicken", 2, 1, eAppetizerTypes.ChickenNuggets);
            //Assert.AreEqual(eAppetizerTypes.ChickenNuggets, appetizer.Type);


            string          name              = "Chicken Nuggets";
            int             quantity          = 2;
            int             dinerSerialNumber = 1;
            eAppetizerTypes appetizerType     = eAppetizerTypes.ChickenNuggets;
            Appetizer       appetizer         = initializeDishes.InitializeAppetizer(name, quantity, dinerSerialNumber, appetizerType);

            Assert.AreEqual(appetizerType, appetizer.Type);
            Assert.AreEqual(dinerSerialNumber, appetizer.DinerSerialNumber);
            Assert.AreEqual(dishesRank.DishTypesRank[eDishTypes.Appetizer], appetizer.MainRank);
            Assert.AreEqual(name, appetizer.Name);
            Assert.AreEqual(dishesPrices.AppetizerPrices[appetizerType], appetizer.Price);
            Assert.AreEqual(quantity, appetizer.Quantity);
            Assert.AreEqual(1, appetizer.SecondRank);
            Assert.AreEqual(dishesRank.AppetizerRanks[appetizerType], appetizer.ThirdRank);
        }
        public void InitializeAppetizer()
        {
            Appetizer appetizer = InitializeDishes.InitializeAppetizer("chicken", 2, 1, eAppetizer.ChickenNuggets);

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