From 2720d484db7a80e8db135cb48a56dc45ecc24d37 Mon Sep 17 00:00:00 2001 From: Mathias Ormstrup Bjerregaard <152613120+MWO1024@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:06:29 +0100 Subject: [PATCH] fix: Update test to not fail in December (#3059) * fix: Update test to not fail in December * apply sanctioned rites to appease the machine spirits in the cloud --- .github/workflows/ci-dotnet.yml | 2 ++ .../WholesaleServicesRequestValidatorTests.cs | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-dotnet.yml b/.github/workflows/ci-dotnet.yml index a88896809f..d8acf22421 100644 --- a/.github/workflows/ci-dotnet.yml +++ b/.github/workflows/ci-dotnet.yml @@ -43,6 +43,7 @@ jobs: uses: Energinet-DataHub/.github/.github/workflows/dotnet-postbuild-test.yml@v14 with: download_attempt_limit: 30 + azure_functions_core_tools_version: 4.0.5413 # Matrix parameters job_name: Unit Tests ${{ matrix.tests_filter_expression.name }} tests_dll_file_path: ${{ matrix.tests_filter_expression.paths }} @@ -132,6 +133,7 @@ jobs: uses: Energinet-DataHub/.github/.github/workflows/dotnet-postbuild-test.yml@v14 with: download_attempt_limit: 30 + azure_functions_core_tools_version: 4.0.5413 azure_integrationtest_tenant_id: ${{ vars.integration_test_azure_tenant_id }} azure_integrationtest_subscription_id: ${{ vars.integration_test_azure_subscription_id }} azure_integrationtest_spn_id: ${{ vars.integration_test_azure_spn_id_oidc }} diff --git a/source/dotnet/wholesale-api/Edi.UnitTests/Validators/WholesaleServicesRequest/WholesaleServicesRequestValidatorTests.cs b/source/dotnet/wholesale-api/Edi.UnitTests/Validators/WholesaleServicesRequest/WholesaleServicesRequestValidatorTests.cs index 401727325d..f3774f12a6 100644 --- a/source/dotnet/wholesale-api/Edi.UnitTests/Validators/WholesaleServicesRequest/WholesaleServicesRequestValidatorTests.cs +++ b/source/dotnet/wholesale-api/Edi.UnitTests/Validators/WholesaleServicesRequest/WholesaleServicesRequestValidatorTests.cs @@ -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()) @@ -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]