public void EndNotStartedRentalTest() { var name = "my company"; IScooterService service = new ScooterService(); service.AddScooter("scooter1", 0.2m); IRentalCompany company = new RentalCompany(name, service, new RentalPriceCalculator(renatlCalculatorMaxPrice), new List <RentedScooter>()); Assert.ThrowsException <ScooterIsNotRentedException>(() => company.EndRent("scooter1")); }
public void EndRent_WhenCalled_CallsScooterRentalCalcServices() { _scooterServiceMock.Setup(x => x.GetScooterById("id")).Returns(new Scooter("id", 1)); _rentalServiceMock.Setup(x => x.EndRentalByScooterId("id")).Returns(new Rental()); _rentalCalculatorMock.Setup(x => x.CalculateScooterRentalPrice(It.IsAny <DateTime>(), It.IsAny <DateTime?>(), It.IsAny <decimal>())) .Returns(5); _rentalCompany.EndRent("id"); _scooterServiceMock.Verify(x => x.GetScooterById("id")); _rentalServiceMock.Verify(x => x.EndRentalByScooterId("id")); _rentalCalculatorMock.Verify(x => x.CalculateScooterRentalPrice(It.IsAny <DateTime>(), It.IsAny <DateTime?>(), 1)); }
public void EndRentTest() { var name = "my company"; IScooterService service = new ScooterService(); service.AddScooter("scooter1", 0.2m); IRentalCompany company = new RentalCompany(name, service, new RentalPriceCalculator(renatlCalculatorMaxPrice), new List <RentedScooter>()); company.StartRent("scooter1"); var scooter = service.GetScooterById("scooter1"); Assert.IsTrue(scooter.IsRented); company.EndRent("scooter1"); Assert.IsFalse(scooter.IsRented); }