Exemplo n.º 1
0
        public void Confirm_order_should_throw_expected_exception_if_status_is_wrong()
        {
            var inputNames = new List <string>()
            {
                "Hawaii", "Fanta", "Kebabpizza"
            };
            var controller = new OrdersController();

            controller.Create(inputNames);
            controller.Cancel(1);
            Assert.ThrowsException <InvalidOperationException>(() => controller.Confirm(1));
        }
Exemplo n.º 2
0
        public async Task Confirm_order_should_throw_expected_exception_if_status_is_wrong()
        {
            var inputNames = new List <string>()
            {
                "Hawaii", "Fanta", "Kebabpizza"
            };
            var controller = new OrdersController(new Storage(), new StorageApiClientFake());

            controller.Create(inputNames);
            controller.Cancel(1);
            await Assert.ThrowsExceptionAsync <InvalidOperationException>(() => controller.Confirm(1));
        }
Exemplo n.º 3
0
        public void Get_ongoing_Should_return_all_active_orders()
        {
            var inputData = new List <List <string> >()
            {
                new List <string>()
                {
                    "Margarita", "Fanta", "Margarita"
                },
                new List <string>()
                {
                    "Kebabpizza", "Sprite", "Kebabpizza"
                },
                new List <string>()
                {
                    "Hawaii", "Coca cola", "Kebabpizza"
                },
                new List <string>()
                {
                    "Margarita", "Fanta", "Kebabpizza"
                },
                new List <string>()
                {
                    "Hawaii", "Sprite", "Kebabpizza"
                },
                new List <string>()
                {
                    "Kebabpizza", "Fanta", "Kebabpizza"
                },
                new List <string>()
                {
                    "Hawaii", "Sprite", "Kebabpizza"
                },
                new List <string>()
                {
                    "Margarita", "Fanta", "Kebabpizza"
                }
            };
            var ordersController = new OrdersController();

            foreach (var inputNames in inputData)
            {
                ordersController.Create(inputNames);
            }
            for (int i = 1; i < inputData.Count; i += 2)
            {
                ordersController.Confirm(i);
            }
            var actual = ordersController.GetActive();

            Assert.AreEqual(4, actual.Count());
        }
Exemplo n.º 4
0
        public void Complete_should_succeed()
        {
            var inputNames = new List <string>()
            {
                "Hawaii", "Fanta", "Kebabpizza"
            };
            var controller = new OrdersController();

            controller.Create(inputNames);
            controller.Confirm(1);
            controller.Complete(1);
            var actual = controller.Get(1);

            Assert.AreEqual(Order.OrderStatus.Completed, actual.Status);
        }
Exemplo n.º 5
0
        public void Confirm_order_should_return_list_of_ingrediens_and_products_and_price()
        {
            var inputNames = new List <string>()
            {
                "Hawaii", "Fanta", "Kebabpizza"
            };
            var controller = new OrdersController();

            controller.Create(inputNames);
            var inputAddable = "Kebab";

            controller.AddAddable(1, 2, inputAddable);
            var actual = controller.Confirm(1);

            Assert.AreEqual(Order.OrderStatus.Confirmed, actual.Status);
        }