Esempio n. 1
0
        public void SearchResultRetunsCarsWithViennaOffice()
        {
            //Arrange
            var          systemUnderTest           = new CarRentalBusinessLayer();
            var          requestedReservationStart = new DateTime(2014, 09, 22, 8, 0, 0);
            var          requestedReservationEnd   = new DateTime(2014, 09, 25, 8, 0, 0);
            var          anonymousCustomerDoSearch = _autoFixture.Create <CustomerModel>();
            const string cityToSearchFor           = "Wien";

            //Act
            var actualResult = systemUnderTest.FindAvailableCarsForRental(anonymousCustomerDoSearch, requestedReservationStart, requestedReservationEnd, cityToSearchFor);

            //Assert
            Func <CarModel, bool> expectedResult = (car => car.Office.City != cityToSearchFor);

            Assert.False(actualResult.Keys.Any(expectedResult));
        }
Esempio n. 2
0
        public void SearchInViennaReturns2Cars()
        {
            //Arrange
            var          systemUnderTest           = new CarRentalBusinessLayer();
            var          requestedReservationStart = new DateTime(2014, 09, 22, 8, 0, 0);
            var          requestedReservationEnd   = new DateTime(2014, 09, 25, 8, 0, 0);
            var          anonymousCustomerDoSearch = _autoFixture.Create <CustomerModel>();
            const string cityToSearchFor           = "Wien";

            //Act
            var actualResult = systemUnderTest.FindAvailableCarsForRental(anonymousCustomerDoSearch, requestedReservationStart, requestedReservationEnd, cityToSearchFor);

            //Assert
            var expectedResult = 2;

            Assert.True(actualResult.Count == expectedResult);
        }
Esempio n. 3
0
        public void CarPriceOfCarTypeBIsCorrectCalculatedForCustomerOfTypeConsumer()
        {
            //Arrange
            var          systemUnderTest                = new CarRentalBusinessLayer();
            var          requestedReservationStart      = new DateTime(2014, 09, 22, 8, 0, 0);
            var          requestedReservationEnd        = new DateTime(2014, 09, 25, 8, 0, 0);
            var          customerOfTypeConsumerDoSearch = _autoFixture.Build <CustomerModel>().With(property => property.CustomerType, CustomerModel.Consumer).Create();
            const string cityToSearchFor                = "Wien";

            //Act
            var actualResult = systemUnderTest.FindAvailableCarsForRental(customerOfTypeConsumerDoSearch, requestedReservationStart, requestedReservationEnd, cityToSearchFor)
                               .Where(availableCar => availableCar.Key.Category == CarModel.Medium).Select(result => result.Value);

            //Assert
            var expectedResult = 195.0m;

            foreach (var price in actualResult)
            {
                Assert.True(price == expectedResult);
            }
        }