public void CanReturnABike()
        {
            // given
            BikeRack bikeRack = BikeTestsObjectMother.AnyBikeRack();

            // when
            BikeReturned bikeReturned = bikeRack.ReturnBike();

            // then
            Check.That(bikeReturned).IsNotNull();
        }
Example #2
0
        public void Given_InvalidBikeId_ThenBikeRentFails()
        {
            // given
            var      invalidId = AnyBikeId();
            Bike     bike      = NonBrokenBike();
            Client   client    = ClientWithSufficientFunds();
            BikeRack bikeRack  = BikeTestsObjectMother.BikeRackWithSingleBike(bike);

            // when
            var result = bikeRack.RentBikeBy(client, invalidId);

            // then
            Check.That(result.TriedToRentInvalidBike).IsNotNull();
        }
Example #3
0
        public void Given_RackWithSingleBike_When_RentABike_ThenBikeIsRent()
        {
            // given
            Bike     bike   = NonBrokenBike();
            BikeRack rack   = BikeTestsObjectMother.BikeRackWithSingleBike(bike);
            Client   client = ClientWithSufficientFunds();


            // when
            BikeRentResult result = rack.RentBikeBy(client, bike.Id);

            // then
            Check.That(result.BikeRent).IsNotNull();
        }
Example #4
0
        public void Given_RackWithAtLeastOneBike_When_RentABikeByClientWithAtLeast10Pln_ThenBikeIsRent()
        {
            // given
            Bike     bike     = NonBrokenBike();
            BikeRack bikeRack = BikeTestsObjectMother.BikeRackWithSingleBike(bike);
            Client   client   = ClientWith(PlnOf(10.00m));


            // when
            var bikeRentResult = bikeRack.RentBikeBy(client, bike.Id);

            // then
            Check.That(bikeRentResult.BikeRent).IsNotNull();
        }
Example #5
0
        public void Given_ClientWithRentedTwoBikes_TryToRentAnotherBike_Then_RentFails()
        {
            // given
            Bike     bike     = NonBrokenBike();
            Client   client   = ClientWithActivesTwoBikes(PlnOf(10.00m));
            BikeRack bikeRack = BikeTestsObjectMother.BikeRackWithSingleBike(bike);

            // when
            var result = bikeRack.RentBikeBy(client, bike.Id);

            // then
            Check.That(result.BikeRent).IsNull();
            Check.That(result.RentLimitExceeded).IsNotNull();
        }
Example #6
0
        public void Given_RackWithOneBike_When_TryToRentBikeTwice_Then_SecondRentFails()
        {
            // given
            Bike     bike     = NonBrokenBike();
            Client   client   = ClientWithSufficientFunds();
            BikeRack bikeRack = BikeTestsObjectMother.BikeRackWithSingleBike(bike);

            // when
            bikeRack.RentBikeBy(client, bike.Id);
            var result = bikeRack.RentBikeBy(client, bike.Id);

            // then
            Check.That(result.BikeRent).IsNull();
            Check.That(result.TriedToRentInvalidBike).IsNotNull();
        }