Exemplo n.º 1
0
        public void StartRentedScooterRentalTest()
        {
            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");
            Assert.ThrowsException <ScooterAlreadyRentedException>(() => company.StartRent("scooter1"));
        }
Exemplo n.º 2
0
        public void StartNotExistingScooterRentalTest()
        {
            var             name    = "my company";
            IScooterService service = new ScooterService();
            IRentalCompany  company = new RentalCompany(name, service, new RentalPriceCalculator(renatlCalculatorMaxPrice), new List <RentedScooter>());

            Assert.ThrowsException <ScooterNotFoundException>(() => company.StartRent("scooter1"));
        }
Exemplo n.º 3
0
        public void StartRentalTest()
        {
            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);
        }
        public void StartRent_WhenCalled_CallsRentalService()
        {
            _rentalCompany.StartRent("id");

            _rentalServiceMock.Verify(x => x.StartRentalByScooterId("id"));
        }