コード例 #1
0
        public void confirmGettingDeliveryIsNoExistDelivery()
        {
            User adresee = EntitySetuper.SetupAdresee(_context);
            long randomNotExsistDeliveryId = 100L;

            var actualResult =
                Assert.Throws <AskedDataIsNotExist>(() => _deliveryService.ConfirmGettingDelivery(
                                                        adresee.UserName,
                                                        randomNotExsistDeliveryId));

            Assert.AreEqual(typeof(AskedDataIsNotExist), actualResult.GetType());
        }
コード例 #2
0
        public void initializeBillIncorrectInWay()
        {
            EntitySetuper.SetupWayWithTarif(_context);

            User setupAdresee            = EntitySetuper.SetupAdresee(_context);
            User setupAdreser            = EntitySetuper.SetupAdreser(_context);
            int  incorrectLocalitySandId = 1000;
            int  incorrectLocalityGetId  = 100;
            DeliveryOrderCreateModel deliveryOrderCreateModel = new DeliveryOrderCreateModel(10,
                                                                                             incorrectLocalitySandId, incorrectLocalityGetId, setupAdresee.Email);

            var actualResult =
                Assert.Throws <NoSuchWayException>(() => _billService.InitializeBill(deliveryOrderCreateModel,
                                                                                     setupAdreser.UserName));

            Assert.AreEqual(typeof(NoSuchWayException), actualResult.GetType());
        }
コード例 #3
0
        public void initializeBillCorrectInCorrectAddressee()
        {
            Way    setupWayWithTarif     = EntitySetuper.SetupWayWithTarif(_context);
            String incorrectAdreseeEmail = "incorrectAdreseeEmail";

            EntitySetuper.SetupAdresee(_context);
            User setupAdreser = EntitySetuper.SetupAdreser(_context);
            DeliveryOrderCreateModel deliveryOrderCreateModel = new DeliveryOrderCreateModel(10,
                                                                                             setupWayWithTarif.LocalitySandLocalityId, setupWayWithTarif.LocalityGetLocalityId,
                                                                                             incorrectAdreseeEmail);

            var actualResult =
                Assert.Throws <NoSuchUserException>(() => _billService.InitializeBill(deliveryOrderCreateModel,
                                                                                      setupAdreser.UserName)
                                                    );

            Assert.AreEqual(typeof(NoSuchUserException), actualResult.GetType());
        }
コード例 #4
0
        public void initializeBillCorrect()
        {
            Way  setupWayWithTarif = EntitySetuper.SetupWayWithTarif(_context);
            User setupAdresee      = EntitySetuper.SetupAdresee(_context);
            User setupAdreser      = EntitySetuper.SetupAdreser(_context);
            DeliveryOrderCreateModel deliveryOrderCreateModel = new DeliveryOrderCreateModel(10,
                                                                                             setupWayWithTarif.LocalitySandLocalityId, setupWayWithTarif.LocalityGetLocalityId, setupAdresee.Email);
            int expectedCost = 200;


            Bill billResult = _billService.InitializeBill(deliveryOrderCreateModel,
                                                          setupAdreser.UserName);

            Assert.AreEqual(setupAdreser.Id, billResult.User.Id);
            Assert.False(billResult.IsDeliveryPaid);
            Assert.False(billResult.Delivery.IsPackageReceived);
            Assert.AreEqual(expectedCost, billResult.CostInCents);
        }