Ejemplo n.º 1
0
        public async Task WhenNotAllItemsAreInStockThenReturnFail()
        {
            var stockItemCheckStep = new CheckItemStockStep(new ProductRepository());
            var customer           = CustomerStatusHelperTest.GetCustomer("Silver",
                                                                          1,
                                                                          new List <Order>()
            {
                CustomerStatusHelperTest.GetOrder(DateTime.UtcNow, 700),
            });

            var order   = GetOrder(DateTime.UtcNow, 700, 3);
            var context = new OrderContext(order)
            {
                Customer = customer,
            };

            var result = await stockItemCheckStep.Run(context);

            Assert.IsTrue(result.IsFailure);
        }
Ejemplo n.º 2
0
        public async Task WhenAllItemsAreInStockThenReturnOK()
        {
            var stockItemCheckStep = new CheckItemStockStep(new ProductRepository());
            var customer           = CustomerStatusHelperTest.GetCustomer("Silver",
                                                                          1,
                                                                          new List <Order>()
            {
                CustomerStatusHelperTest.GetOrder(DateTime.UtcNow, 700),
            });

            var order   = GetOrder(DateTime.UtcNow, 700, 1);
            var context = new OrderContext(order)
            {
                Customer = customer,
            };

            var result = await stockItemCheckStep.Run(context);

            Assert.IsTrue(result.IsSuccess);
            Assert.AreEqual("All items are in stock", result.Value);
        }