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); }