Exemplo n.º 1
0
        public void testFillingDoesNotRemoveIfNotEnoughInStock()
        {
            Order order = new Order(TALISKER, 51);
            //-- Creating a fake ICustomerRepository object
            var warehouseMock = new Mock <WareHouse>();

            warehouseMock
            .Setup(m => m.FillIt(It.IsAny <string>(), It.IsAny <int>()))
            .Returns(false);

            order.Fill(warehouseMock.Object);


            //-- Assert ----------------------
            Assert.IsFalse(order.isFilled());

            warehouseMock.Verify(x => x.FillIt(It.IsAny <string>(), It.IsAny <int>()), Times.Exactly(1));
        }
Exemplo n.º 2
0
        public void testOrderIsFilledIfEnoughInWarehouseMock()
        {
            Order order = new Order(TALISKER, 50);
            //-- Creating a fake ICustomerRepository object
            var warehouseMock = new Mock <WareHouse>();

            //warehouseMock

            warehouseMock
            .Setup(m => m.FillIt(TALISKER, 50))
            .Returns(true);

            order.Fill(warehouseMock.Object);


            //-- Assert ----------------------
            Assert.IsTrue(order.isFilled());


            warehouseMock.Verify(x => x.FillIt(It.IsAny <string>(), It.IsAny <int>()), Times.Exactly(1));
        }