Skip to content

Commit

Permalink
fix: Update test to not fail in December
Browse files Browse the repository at this point in the history
  • Loading branch information
MWO1024 committed Dec 4, 2024
1 parent 7c0b921 commit 3e39e9b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,17 @@ public async Task Validate_WhenPeriodStartAndPeriodEndAreInvalidFormat_ReturnsUn
// Arrange
var now = SystemClock.Instance.GetCurrentInstant().ToDateTimeOffset();

var startToYearsAgo = now.AddYears(-2);
var endToYearsAgo = now.AddYears(-2).AddMonths(1);

var request = new WholesaleServicesRequestBuilder()
.WithPeriodStart(
new LocalDateTime(now.Year - 2, now.Month, 1, 17, 45, 12)
new LocalDateTime(startToYearsAgo.Year, startToYearsAgo.Month, 1, 17, 45, 12)
.InZoneStrictly(DateTimeZoneProviders.Tzdb.GetZoneOrNull("Europe/Copenhagen")!)
.ToInstant()
.ToString())
.WithPeriodEnd(
new LocalDateTime(now.Year - 2, now.Month + 1, 1, 8, 13, 56)
new LocalDateTime(endToYearsAgo.Year, endToYearsAgo.Month, 1, 8, 13, 56)
.InZoneStrictly(DateTimeZoneProviders.Tzdb.GetZoneOrNull("Europe/Copenhagen")!)
.ToInstant()
.ToString())
Expand All @@ -113,8 +116,7 @@ public async Task Validate_WhenPeriodStartAndPeriodEndAreInvalidFormat_ReturnsUn
var validationErrors = await _sut.ValidateAsync(request);

// Assert
validationErrors.Should().HaveCount(2);
validationErrors.Select(e => e.ErrorCode).Should().BeEquivalentTo(["D66", "D66"]);
validationErrors.Where(x => x.ErrorCode == "D66").Should().HaveCount(2);
}

[Fact]
Expand Down

0 comments on commit 3e39e9b

Please sign in to comment.