public void ShouldReturnOk()
        {
            var sut     = GetDefaultBabySitterController();
            var request = new CalculatePayRequest
            {
                StartTime = new DateTime(2020, 01, 01, 18, 00, 00),
                EndTime   = new DateTime(2020, 01, 01, 20, 00, 00)
            };

            var response = (OkObjectResult)sut.CalculatePay(request);

            response.StatusCode.Should().Be(200);
        }
        public void ShouldReturnBadRequest_GivenStartTimeBefore1700()
        {
            var sut     = GetDefaultBabySitterController();
            var request = new CalculatePayRequest
            {
                StartTime = new DateTime(2020, 01, 01, 16, 00, 00),
                EndTime   = new DateTime(2020, 01, 02, 18, 00, 00)
            };

            var response = (BadRequestObjectResult)sut.CalculatePay(request);

            response.StatusCode.Should().Be(400);
            response.Value.Should().Be("StartTime before 5:00PM is invalid.");
        }
        public void ShouldReturnBadRequest_GivenEndTimeAfter0400TheNextDay()
        {
            var sut     = GetDefaultBabySitterController();
            var request = new CalculatePayRequest
            {
                StartTime = new DateTime(2020, 01, 01, 18, 00, 00),
                EndTime   = new DateTime(2020, 01, 02, 05, 00, 00)
            };

            var response = (BadRequestObjectResult)sut.CalculatePay(request);

            response.StatusCode.Should().Be(400);
            response.Value.Should().Be("EndTime after 4:00AM the next day is invalid.");
        }
        public void ShouldCalculateRateAt8DollarsPerHour_GivenTimeIsAfterBedtimeAndBeforeMidnight()
        {
            var configuration = new ConfigurationBuilder()
                                .AddInMemoryCollection(new Dictionary <string, string>
            {
                { "BedtimeHour", "18" }
            }).Build();
            var sut     = new BabySitterController(configuration);
            var request = new CalculatePayRequest
            {
                StartTime = new DateTime(2020, 01, 01, 19, 00, 00),
                EndTime   = new DateTime(2020, 01, 01, 20, 00, 00)
            };

            var response = (OkObjectResult)sut.CalculatePay(request);

            response.StatusCode.Should().Be(200);
            response.Value.Should().Be("$8.00");
        }
        public void ShouldCalculatePayForAllRates()
        {
            var configuration = new ConfigurationBuilder()
                                .AddInMemoryCollection(new Dictionary <string, string>
            {
                { "BedtimeHour", "20" }
            }).Build();
            var sut     = new BabySitterController(configuration);
            var request = new CalculatePayRequest
            {
                StartTime = new DateTime(2020, 01, 01, 17, 00, 00),
                EndTime   = new DateTime(2020, 01, 02, 04, 00, 00)
            };

            var response = (OkObjectResult)sut.CalculatePay(request);

            response.StatusCode.Should().Be(200);
            response.Value.Should().Be("$132.00");
        }