Skip to content

Commit

Permalink
Use DurableFunction.TestCommon (and update TestCommon)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebbeknudsen committed Dec 9, 2024
1 parent 9a58516 commit 0a31259
Show file tree
Hide file tree
Showing 27 changed files with 49 additions and 267 deletions.
2 changes: 1 addition & 1 deletion source/ArchitectureTests/ArchitectureTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ limitations under the License.
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="FluentAssertions.Analyzers" Version="0.34.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ limitations under the License.

<ItemGroup>
<PackageReference Include="AdaskoTheBeAsT.Dapper.NodaTime" Version="4.0.2" />
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="7.0.4" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="7.1.1-alpha-387" />
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down
3 changes: 2 additions & 1 deletion source/B2BApi.AppTests/B2BApi.AppTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Energinet.DataHub.Core.DurableFunctionApp.TestCommon" Version="7.1.1-alpha-387" />
<PackageReference Include="Energinet.DataHub.Wholesale.Contracts" Version="11.0.0" />
<PackageReference Include="FluentAssertions.Analyzers" Version="0.34.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="CsvHelper" Version="33.0.1" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="3.0.1" />
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="7.0.4" />
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="7.1.1-alpha-387" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
108 changes: 0 additions & 108 deletions source/B2BApi.AppTests/DurableTask/DurableClientExtensions.cs

This file was deleted.

112 changes: 0 additions & 112 deletions source/B2BApi.AppTests/DurableTask/DurableTaskManager.cs

This file was deleted.

2 changes: 1 addition & 1 deletion source/B2BApi.AppTests/Fixtures/B2BApiAppFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Diagnostics.CodeAnalysis;
using Azure.Storage.Blobs;
using Energinet.DataHub.Core.Databricks.SqlStatementExecution;
using Energinet.DataHub.Core.DurableFunctionApp.TestCommon.DurableTask;
using Energinet.DataHub.Core.FunctionApp.TestCommon.Azurite;
using Energinet.DataHub.Core.FunctionApp.TestCommon.Configuration;
using Energinet.DataHub.Core.FunctionApp.TestCommon.Databricks;
Expand All @@ -24,7 +25,6 @@
using Energinet.DataHub.Core.FunctionApp.TestCommon.ServiceBus.ResourceProvider;
using Energinet.DataHub.Core.Messaging.Communication.Extensions.Options;
using Energinet.DataHub.Core.TestCommon.Diagnostics;
using Energinet.DataHub.EDI.B2BApi.AppTests.DurableTask;
using Energinet.DataHub.EDI.B2BApi.Functions;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Infrastructure.Configuration.Options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

using System.Collections.Immutable;
using Azure.Messaging.ServiceBus;
using Energinet.DataHub.Core.DurableFunctionApp.TestCommon.DurableTask;
using Energinet.DataHub.Core.FunctionApp.TestCommon.Databricks;
using Energinet.DataHub.Core.FunctionApp.TestCommon.ServiceBus.ListenerMock;
using Energinet.DataHub.Core.TestCommon;
using Energinet.DataHub.EDI.B2BApi.AppTests.DurableTask;
using Energinet.DataHub.EDI.B2BApi.AppTests.Fixtures;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;
using Energinet.DataHub.EDI.IntegrationTests.Behaviours.IntegrationEvents.TestData;
Expand Down Expand Up @@ -110,10 +110,10 @@ public async Task Given_CalculationOrchestrationId_When_CalculationCompletedEven

// Assert
// => Verify expected behaviour by searching the orchestration history
var actualOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestrationStatusAsync(createdTimeFrom: beforeOrchestrationCreated);
var actualOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestationStartedAsync(createdTimeFrom: beforeOrchestrationCreated);

// => Wait for completion
var completeOrchestrationStatus = await Fixture.DurableClient.WaitForInstanceCompletedAsync(
var completeOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestrationCompletedAsync(
actualOrchestrationStatus.InstanceId,
TimeSpan.FromMinutes(5));

Expand Down Expand Up @@ -206,10 +206,10 @@ await ClearAndAddDatabricksData(

// Assert
// => Verify expected behaviour by searching the orchestration history
var actualOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestrationStatusAsync(createdTimeFrom: beforeOrchestrationCreated);
var actualOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestationStartedAsync(createdTimeFrom: beforeOrchestrationCreated);

// => Wait for completion
var completeOrchestrationStatus = await Fixture.DurableClient.WaitForInstanceCompletedAsync(
var completeOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestrationCompletedAsync(
actualOrchestrationStatus.InstanceId,
TimeSpan.FromMinutes(5));

Expand Down Expand Up @@ -301,7 +301,7 @@ public async Task Given_DatabricksHasNoData_When_CalculationCompletedEventIsHand

// Assert
// => Verify expected behaviour by searching the orchestration history
var actualOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestrationStatusAsync(createdTimeFrom: beforeOrchestrationCreated);
var actualOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestationStartedAsync(createdTimeFrom: beforeOrchestrationCreated);

// => Wait for running and expected history
JArray? actualHistory = null;
Expand Down Expand Up @@ -359,7 +359,7 @@ await ClearAndAddInvalidDatabricksData(
// Act
var beforeOrchestrationCreated = DateTime.UtcNow;
await Fixture.TopicResource.SenderClient.SendMessageAsync(wholesaleCalculationCompletedEventMessage);
var actualWholesaleOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestrationStatusAsync(createdTimeFrom: beforeOrchestrationCreated);
var actualWholesaleOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestationStartedAsync(createdTimeFrom: beforeOrchestrationCreated);

// Assert
using var assertionScope = new AssertionScope();
Expand Down Expand Up @@ -423,7 +423,7 @@ await ClearAndAddInvalidDatabricksData(
// Act
var beforeOrchestrationCreated = DateTime.UtcNow;
await Fixture.TopicResource.SenderClient.SendMessageAsync(energyCalculationCompletedEventMessage);
var actualEnergyOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestrationStatusAsync(createdTimeFrom: beforeOrchestrationCreated);
var actualEnergyOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestationStartedAsync(createdTimeFrom: beforeOrchestrationCreated);

// Assert
using var assertionScope = new AssertionScope();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

using System.Diagnostics;
using System.Net;
using Energinet.DataHub.Core.DurableFunctionApp.TestCommon.DurableTask;
using Energinet.DataHub.Core.FunctionApp.TestCommon.Databricks;
using Energinet.DataHub.EDI.B2BApi.AppTests.DurableTask;
using Energinet.DataHub.EDI.B2BApi.AppTests.Fixtures;
using Energinet.DataHub.EDI.B2BApi.AppTests.Fixtures.Extensions;
using Energinet.DataHub.EDI.B2BApi.Functions.RequestWholesaleServices;
Expand Down Expand Up @@ -88,13 +88,13 @@ public async Task Given_RequestWholesaleServices_When_RequestWholesaleServicesOr
await httpResponse.EnsureSuccessStatusCodeWithLogAsync(Fixture.TestLogger);

// => Wait for orchestration to start
var startedOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestrationStatusAsync(
var startedOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestationStartedAsync(
createdTimeFrom: beforeOrchestrationCreated.ToDateTimeUtc(),
name: nameof(RequestWholesaleServicesOrchestration));
startedOrchestrationStatus.Should().NotBeNull();

// => Wait for orchestration to complete
var completedOrchestrationStatus = await Fixture.DurableClient.WaitForInstanceCompletedAsync(
var completedOrchestrationStatus = await Fixture.DurableClient.WaitForOrchestrationCompletedAsync(
startedOrchestrationStatus.InstanceId,
TimeSpan.FromMinutes(5));
completedOrchestrationStatus.Should().NotBeNull();
Expand Down
2 changes: 1 addition & 1 deletion source/B2CWebApi.AppTests/B2CWebApi.AppTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="7.0.4" />
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="7.1.1-alpha-387" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
4 changes: 2 additions & 2 deletions source/BuildingBlocks.Tests/BuildingBlocks.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ limitations under the License.
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="7.0.4" />
<PackageReference Include="Energinet.DataHub.Core.FunctionApp.TestCommon" Version="7.1.1-alpha-387" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.18.2" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="FluentAssertions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.9.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.OpenApi" Version="1.6.22" />
Expand Down
Loading

0 comments on commit 0a31259

Please sign in to comment.