public void getDeliveryCostAndTimeDtoAllCorrect() { Way way = EntitySetuper.SetupWayWithTarif(_context); DeliveryInfoRequestModel deliveryInfoRequestDto = new DeliveryInfoRequestModel(10, way.LocalitySandLocalityId, way.LocalityGetLocalityId); PriceAndTimeOnDeliveryModel priceAndTimeOnDeliveryModel = new PriceAndTimeOnDeliveryModel(200, 2); PriceAndTimeOnDeliveryModel result = _deliveryService.GetDeliveryCostAndTimeDto(deliveryInfoRequestDto); Assert.AreEqual(priceAndTimeOnDeliveryModel, result); }
public void GetLocalities() { Way way = EntitySetuper.SetupWayWithTarif(_context); LocalityModel expectedGet = new LocalityModel(way.LocalityGetLocalityId, way.LocalityGet.NameEn); LocalityModel expectedSend = new LocalityModel(way.LocalitySandLocalityId, way.LocalitySand.NameEn); List <LocalityModel> result = _localityService.GetLocalities(); Assert.AreEqual(expectedSend, result[0]); Assert.AreEqual(expectedGet, result[1]); Assert.AreEqual(2, result.Count); }
public void getDeliveryCostAndTimeIncorrectWay() { Way way = EntitySetuper.SetupWayWithTarif(_context); int notExistLocalitySend = 300; DeliveryInfoRequestModel deliveryInfoRequestDto = new DeliveryInfoRequestModel(10, notExistLocalitySend, way.LocalityGetLocalityId); var actualResult = Assert.Throws <NoSuchWayException>(() => _deliveryService.GetDeliveryCostAndTimeDto(deliveryInfoRequestDto)); Assert.AreEqual(typeof(NoSuchWayException), actualResult.GetType()); }
public void getDeliveryCostAndTimeIncorrectWeightFactorBiggerOnOne() { Way way = EntitySetuper.SetupWayWithTarif(_context); int weightBigerOnOneOfMaximumTarifWeightFactor = EntitySetuper.MAX_WRIGHT_ON_SETUPED_TARIF_WEIGHT_FACTOR + 1; DeliveryInfoRequestModel deliveryInfoRequestDto = new DeliveryInfoRequestModel(weightBigerOnOneOfMaximumTarifWeightFactor, way.LocalitySandLocalityId, way.LocalityGetLocalityId); var actualResult = Assert.Throws <UnsupportableWeightFactorException>(() => _deliveryService.GetDeliveryCostAndTimeDto(deliveryInfoRequestDto)); Assert.AreEqual(typeof(UnsupportableWeightFactorException), actualResult.GetType()); }
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()); }
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()); }
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); }