Пример #1
0
        public async Task GetApplicableRateAsync_NightRate()
        {
            //Night Rate
            using (var context = new CarParkContext())
            {
                var repository = new CarParkRepository(context);

                var entry = DateTime.Parse("20/08/2020 07:30:00 PM");
                var exit  = DateTime.Parse("21/08/2020 04:30:00 PM");

                //Act
                var rate = await repository.GetApplicableRateAsync(entry, exit);

                //Assert
                Assert.True(rate.Name == "Night Rate");
                Assert.True(rate.Price == 6.5);
            }

            //Night Rate instead of Weekend rate
            using (var context = new CarParkContext())
            {
                var repository = new CarParkRepository(context);

                var entry = DateTime.Parse("21/08/2020 11:30:00 PM");
                var exit  = DateTime.Parse("22/08/2020 04:30:00 PM");

                //Act
                var rate = await repository.GetApplicableRateAsync(entry, exit);

                //Assert
                Assert.True(rate.Name == "Night Rate");
                Assert.True(rate.Price == 6.5);
            }
        }
Пример #2
0
        public async Task GetApplicableRateAsync_StandardRate_Hourly()
        {
            //Standard Rate - Hourly
            using (var context = new CarParkContext())
            {
                var repository = new CarParkRepository(context);

                var entry = DateTime.Parse("20/08/2020 09:30:00 PM");
                var exit  = DateTime.Parse("20/08/2020 11:35:00 PM");

                //Act
                var rate = await repository.GetApplicableRateAsync(entry, exit);

                //Assert
                Assert.True(rate.Name == "Standard Rate");
                Assert.True(rate.Price == 15);
            }
        }
Пример #3
0
        public async Task GetApplicableRateAsync_WeekendRate()
        {
            //Weekend Rate
            using (var context = new CarParkContext())
            {
                var repository = new CarParkRepository(context);

                var entry = DateTime.Parse("22/08/2020 07:30:00 PM");
                var exit  = DateTime.Parse("23/08/2020 04:30:00 PM");

                //Act
                var rate = await repository.GetApplicableRateAsync(entry, exit);

                //Assert
                Assert.True(rate.Name == "Weekend Rate");
                Assert.True(rate.Price == 10);
            }
        }
Пример #4
0
        public async Task GetApplicableRateAsync_EarlyBird()
        {
            //Early Bird
            using (var context = new CarParkContext())
            {
                var repository = new CarParkRepository(context);

                var entry = DateTime.Parse("20/08/2020 08:00:00 AM");
                var exit  = DateTime.Parse("20/08/2020 04:30:00 PM");

                //Act
                var rate = await repository.GetApplicableRateAsync(entry, exit);

                //Assert
                Assert.True(rate.Name == "Early Bird");
                Assert.True(rate.Price == 13);
            }
        }