Example #1
0
        public void NoLotteryTicketFailTest()
        {
            orderDbMocker.Setup(x => x.RandomOrderID()).Returns(100010);
            storeSyncherMock.Setup(x => x.ValidateTicket(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <double>()))
            .Throws(new OrderException(OrderStatus.InvalidCoupon, "some message"));
            slave = new LotteryTicketSlave(userBuyerMocker.Object, storeSyncherMock.Object, orderDbMocker.Object, publisherMock.Object, policyMock.Object);
            Order order = slave.BuyLotteryTicket("#9 Large", "Cluckin Bell", 1, 5.00, "Big Smoke", "Grove Street", "12345678");

            Assert.IsNull(order);
            Assert.AreEqual((int)OrderStatus.InvalidCoupon, slave.Answer.Status);
        }
Example #2
0
        public void GuestBuyFailTest()
        {
            orderDbMocker.Setup(x => x.RandomOrderID()).Returns(100010);
            userBuyerMocker.Setup(x => x.ValidateRegisteredUser())
            .Throws(new MarketException((int)EditCartItemStatus.DidntEnterSystem, ""));
            slave = new LotteryTicketSlave(userBuyerMocker.Object, storeSyncherMock.Object, orderDbMocker.Object, publisherMock.Object, policyMock.Object);
            Order order = slave.BuyLotteryTicket("#9 Large", "Cluckin Bell", 1, 5.00, "Big Smoke", "Grove Street", "12345678");

            Assert.IsNull(order);
            Assert.AreEqual((int)EditCartItemStatus.DidntEnterSystem, slave.Answer.Status);
        }
Example #3
0
        public void BuyTicketTest()
        {
            orderDbMocker.Setup(x => x.RandomOrderID()).Returns(100010);
            slave = new LotteryTicketSlave(userBuyerMocker.Object, storeSyncherMock.Object, orderDbMocker.Object, publisherMock.Object, policyMock.Object);
            Order order = slave.BuyLotteryTicket("#9 Large", "Cluckin Bell", 1, 5.00, "Big Smoke", "Grove Street", "12345678");

            Assert.IsNotNull(order);
            Assert.AreEqual(1, order.GetItems().Count);
            Assert.IsNotNull(order.GetOrderItem("#9 Large", "Cluckin Bell"));
            OrderItem actual = order.GetOrderItem("#9 Large", "Cluckin Bell");

            Assert.AreEqual(item2.Name, actual.Name);
            Assert.AreEqual(5.00, actual.Price);
            Assert.AreEqual(item2.Quantity, actual.Quantity);
            Assert.AreEqual(item2.Store, actual.Store);
        }