public void Setup()
        {
            orderBuilder = new MockOrderBuilder();
            saleProductRepository = new Mock<ISaleProductRepository>();
            orderRepository = new Mock<ISaleRepository>();
            outletRepository = new Mock<IOutletRepository>();
            inventoryRepository = new Mock<IInventoryRepository>();
            returnableProductRepository = new Mock<IReturnableProductRepository>();

            commandHandler = new IncomingCommandHandler(orderRepository.Object, outletRepository.Object, saleProductRepository.Object, inventoryRepository.Object, returnableProductRepository.Object);
        }
示例#2
0
        public void CanUnsellReturnablesForExistingItem()
        {
            var sale = new MockOrderBuilder()
                      .WithSaleLineItem(quantity: 25, sellReturnables:true)
                      .Build();

            Assert.AreEqual(3, sale.AllInvoiceItems.Count, "invoice items");
            
            sale.UnsellReturnablesForItem(sale.LineItems.First());

            Assert.AreEqual(1, sale.AllInvoiceItems.Count, "invoice items");
        }
示例#3
0
        public void CanSellReturnablesForExistingItem()
        {
            var sale = new MockOrderBuilder()
                .WithSaleLineItem()
                .Build();

            Assert.AreEqual(1, sale.AllInvoiceItems.Count, "invoice items");
            
            sale.SellReturnablesForItem(sale.LineItems.First());

            Assert.AreEqual(2, sale.AllInvoiceItems.Count, "invoice items");
            Assert.AreEqual(1, sale.ReturnableLineItems.First().SaleQuantity, "sale quantity");
            Assert.AreEqual(LineItemStatus.Approved, sale.ReturnableLineItems.First().LineItemStatus, "status");
        }