// ReSharper disable once InconsistentNaming public void ParseAirTime_should_calculate_12_hour_clock_correctly() { var parser = new DateParser(); for (int hour = 0; hour < 23; hour++) { for (int minute = 0; minute < 59; minute++) { var time = new DateTime(1, 1, 1, hour, minute, 0); string value = time.ToString("hh:mm tt", CultureInfo.InvariantCulture); // ReSharper disable once PossibleInvalidOperationException var parsed = parser.ParseAirTime(value).Value; Assert.Equal(time.ToString("HH:mm"), parsed.ToString("HH:mm")); } } }
// ReSharper disable once InconsistentNaming public void ParseAirTime_should_throw_if_passed_null_or_white_space(string value) { var parser = new DateParser(); Assert.Throws<InvalidOperationException>(() => parser.ParseAirTime(value)); }
// ReSharper disable once InconsistentNaming public void ParseAirTime_should_return_null_if_minute_is_out_of_range(string value) { var parser = new DateParser(); Assert.Null(parser.ParseAirTime(value)); }
// ReSharper disable once InconsistentNaming public void ParseAirTime_should_return_null_if_minute_is_not_an_integer() { var parser = new DateParser(); Assert.Null(parser.ParseAirTime("00:A")); }
// ReSharper disable once InconsistentNaming public void ParseAirTime_should_throw_should_return_null_if_colon_is_missing() { var parser = new DateParser(); Assert.Null(parser.ParseAirTime("9000")); }