public void GetJsonRates_GarageClosedOnDay_ExpectedResult()
        {
            //Arrange
            var jsonFileParserService = Substitute.For <IJsonFileParserService>();

            jsonFileParserService.GetRatesFromJson(Arg.Any <string>()).Returns(new List <RatesForDay>
            {
                new RatesForDay
                {
                    Day   = DayOfWeek.Monday,
                    Rates = new List <RateForTimePeriod>
                    {
                        new RateForTimePeriod
                        {
                            StartTime = DateTime.Parse("Nov 27 2017, 4PM"),
                            EndTime   = DateTime.Parse("Nov 27 2017, 6PM"),
                            Price     = 2500
                        },
                    }
                }
            });

            var ratesRepo = new RatesRepositoryMockBuilder().BuildWith(jsonFileParserService).Build();

            //Act
            var result = ratesRepo.GetRateForTimePeriod(DateTime.Parse("Nov 28 2017, 4:00PM"), DateTime.Parse("Nov 28 2017, 4:10PM"));

            //Assert
            Assert.IsNull(result);
        }
        public void GetJsonRates_RatesWithinOnePeriod_SuccessfullyRetrievesRate()
        {
            //Arrange
            var jsonFileParserService = Substitute.For <IJsonFileParserService>();

            jsonFileParserService.GetRatesFromJson(Arg.Any <string>()).Returns(new List <RatesForDay>
            {
                new RatesForDay
                {
                    Day   = DayOfWeek.Monday,
                    Rates = new List <RateForTimePeriod>
                    {
                        new RateForTimePeriod
                        {
                            StartTime = DateTime.Parse("Nov 27 2017, 4PM"),
                            EndTime   = DateTime.Parse("Nov 27 2017, 6PM"),
                            Price     = 2500
                        },
                    }
                }
            });

            var ratesRepo = new RatesRepositoryMockBuilder().BuildWith(jsonFileParserService).Build();

            //Act
            var result = ratesRepo.GetRateForTimePeriod(DateTime.Parse("Nov 27 2017, 4:10PM"), DateTime.Parse("Nov 27 2017, 4:50PM"));

            //Assert
            Assert.IsTrue(result.Price == 2500);
        }
        public void GetJsonRates_EndTimeBeforeStartTime_ThrowsException()
        {
            //Arrange
            var jsonFileParserService = Substitute.For <IJsonFileParserService>();

            jsonFileParserService.GetRatesFromJson(Arg.Any <string>()).Returns(new List <RatesForDay>
            {
                new RatesForDay
                {
                    Day   = DayOfWeek.Monday,
                    Rates = new List <RateForTimePeriod>
                    {
                        new RateForTimePeriod
                        {
                            StartTime = DateTime.Parse("Nov 27 2017, 4PM"),
                            EndTime   = DateTime.Parse("Nov 27 2017, 6PM"),
                            Price     = 2500
                        },
                    }
                }
            });

            var ratesRepo = new RatesRepositoryMockBuilder().BuildWith(jsonFileParserService).Build();

            //Act
            var result = ratesRepo.GetRateForTimePeriod(DateTime.Parse("Nov 27 2017, 4:50PM"), DateTime.Parse("Nov 27 2017, 4:10PM"));

            //Assert
        }