Exemplo n.º 1
0
        public void initializeBillCorrectInCorrectAddressee()
        {
            Bill bill = ServicesTestConstant.getBill();

            bill.CostInCents    = _defaultCostInCents;
            bill.BillId         = _defaultBillId;
            bill.IsDeliveryPaid = false;
            Delivery delivery = ServicesTestConstant.getDelivery();

            delivery.DeliveryId = _defaultDeliveryId;
            _userRepository.Setup(a => a.FindByEmail(It.IsAny <string>())
                                  ).Returns(null as User);

            var actualResult =
                Assert.Throws <NoSuchUserException>(() => _billService.InitializeBill
                                                        (ServicesTestConstant.getDeliveryOrderCreateDto(), ServicesTestConstant.getUserId()));

            Assert.AreEqual(typeof(NoSuchUserException), actualResult.GetType());
        }
Exemplo n.º 2
0
        public void initializeBillCorrect()
        {
            Bill bill = ServicesTestConstant.getBill();

            bill.CostInCents    = _defaultCostInCents;
            bill.BillId         = _defaultBillId;
            bill.IsDeliveryPaid = false;
            Delivery delivery = ServicesTestConstant.getDelivery();

            delivery.DeliveryId = _defaultDeliveryId;
            _wayRepository.Setup(a => a.FindByLocalitySand_IdAndLocalityGet_Id
                                     (It.IsAny <long>(), It.IsAny <long>())
                                 ).Returns(ServicesTestConstant.getWay());

            Bill billResult = _billService.InitializeBill(ServicesTestConstant.getDeliveryOrderCreateDto(),
                                                          ServicesTestConstant.getUserId());

            Assert.AreEqual(bill, billResult);
        }
Exemplo n.º 3
0
        public void initializeBillIncorrectInWay()
        {
            Bill bill = ServicesTestConstant.getBill();

            bill.CostInCents    = _defaultCostInCents;
            bill.BillId         = _defaultBillId;
            bill.IsDeliveryPaid = false;
            Delivery delivery = ServicesTestConstant.getDelivery();

            delivery.DeliveryId = _defaultDeliveryId;

            _wayRepository.Setup(a => a.FindByLocalitySand_IdAndLocalityGet_Id
                                     (It.IsAny <long>(), It.IsAny <long>())
                                 ).Returns((Way)null);

            var actualResult =
                Assert.Throws <NoSuchWayException>(() => _billService.InitializeBill
                                                       (ServicesTestConstant.getDeliveryOrderCreateDto(), ServicesTestConstant.getUserId()));

            Assert.AreEqual(typeof(NoSuchWayException), actualResult.GetType());
        }