[InlineData("2018-08-01", "2018-08-31", 22)] //August month public void GetWorkDaysBefore(string firstDate, string secondDate, int actual) { using var tolkDbContext = CreateTolkDbContext(DbNameWithHolidays); var subject = new DateCalculationService(CreateCacheService(tolkDbContext)); subject.GetWorkDaysBetween(DateTime.Parse(firstDate), DateTime.Parse(secondDate)) .Should().Be(actual, "there are {0} workdays between {1} and {2}", actual, firstDate, secondDate); }
public void GetWorkDaysBetween_ThrowsIfFirstDateIsAfterSecondDate() { using var tolkDbContext = CreateTolkDbContext(); var subject = new DateCalculationService(CreateCacheService(tolkDbContext)); Action a = () => subject.GetWorkDaysBetween(new DateTime(1), new DateTime(0)); a.Should().Throw <ArgumentException>(); }
public void GetWorkDaysBetween_ThrowsIfSecondDateIsNotPlainDate() { using var tolkDbContext = CreateTolkDbContext(); var subject = new DateCalculationService(CreateCacheService(tolkDbContext)); Action a = () => subject.GetWorkDaysBetween(new DateTime(2018, 06, 04), new DateTime(2018, 06, 05, 14, 00, 00)); a.Should().Throw <ArgumentException>() .And.ParamName.Should().Be("secondDate"); }
public void GetWorkDaysBetween_ThrowsDateTimeKindsAreDifferent() { using var tolkDbContext = CreateTolkDbContext(); var subject = new DateCalculationService(CreateCacheService(tolkDbContext)); Action a = () => subject.GetWorkDaysBetween( new DateTime(2018, 5, 1, 0, 0, 0, DateTimeKind.Local), new DateTime(2018, 6, 1, 0, 0, 0, DateTimeKind.Unspecified)); a.Should().Throw <ArgumentException>(); }