Skip to content

Commit

Permalink
Merge pull request #12 from Hefaistos68/testings
Browse files Browse the repository at this point in the history
Conditioned Nager.Date Provider unit tests
  • Loading branch information
Hefaistos68 authored Apr 13, 2023
2 parents 9cc748e + cf318cf commit 109deef
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,21 @@ public void CanCall_NumberOfHolidaysUntil_WithDefaultHolidayProvider()
[TestMethod]
public void CanCall_NumberOfHolidaysUntil_WithNagerDateHolidayProvider()
{
// Arrange
DateTimeExtensions.SetHolidayProvider(new NagerHolidayProvider());

// Act
var result = _startDate.NumberOfHolidaysUntil(_endDate, _cultureInfo);

// Assert
result.ShouldBe(_holidaysInStartDateToEndDateNagerDate);
try
{
// Arrange
DateTimeExtensions.SetHolidayProvider(new NagerHolidayProvider());

// Act
var result = _startDate.NumberOfHolidaysUntil(_endDate, _cultureInfo);

// Assert
result.ShouldBe(_holidaysInStartDateToEndDateNagerDate);
}
catch (Nager.Date.NoLicenseKeyException)
{
// this test will only be executed with a Nager.Date license key
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,21 @@ public void CanCall_NumberOfHolidaysUntil_WithDefaultHolidayProvider()
[TestMethod]
public void CanCall_NumberOfHolidaysUntil_WithNagerDateHolidayProvider()
{
// Arrange
DateTimeExtensions.SetHolidayProvider(new NagerHolidayProvider());

// Act
var result = _startDate.NumberOfHolidaysUntil(_endDate, _cultureInfo);

// Assert
result.ShouldBe(_holidaysInStartDateToEndDateNagerDate);
try
{
// Arrange
DateTimeExtensions.SetHolidayProvider(new NagerHolidayProvider());

// Act
var result = _startDate.NumberOfHolidaysUntil(_endDate, _cultureInfo);

// Assert
result.ShouldBe(_holidaysInStartDateToEndDateNagerDate);
}
catch (Nager.Date.NoLicenseKeyException)
{
// this test will only be executed with a Nager.Date license key
}
}

/// <summary>
Expand Down

0 comments on commit 109deef

Please sign in to comment.