Skip to content

Commit

Permalink
Fix B2C tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ebbeknudsen committed Dec 11, 2024
1 parent 0a62753 commit 95a25f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions source/B2CWebApi.AppTests/B2CWebApi.AppTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<ItemGroup>
<PackageReference Include="Energinet.DataHub.Core.Messaging" Version="6.1.1" />
<PackageReference Include="Energinet.DataHub.ProcessManager.Client" Version="0.14.1" />
<PackageReference Include="FluentAssertions.Analyzers" Version="0.34.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down Expand Up @@ -42,6 +43,7 @@
<ProjectReference Include="..\AuditLog\AuditLog.csproj" />
<ProjectReference Include="..\B2CWebApi\B2CWebApi.csproj" />
<ProjectReference Include="..\BuildingBlocks.Tests\BuildingBlocks.Tests.csproj" />
<ProjectReference Include="..\IncomingMessages.Infrastructure\IncomingMessages.Infrastructure.csproj" />
<ProjectReference Include="..\Outbox.Infrastructure\Outbox.Infrastructure.csproj" />
</ItemGroup>

Expand Down
14 changes: 11 additions & 3 deletions source/B2CWebApi.AppTests/Fixture/B2CWebApiFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Infrastructure.Configuration.Options;
using Energinet.DataHub.EDI.BuildingBlocks.Tests.Database;
using Energinet.DataHub.EDI.IncomingMessages.Infrastructure.Configuration.Options;
using Energinet.DataHub.ProcessManager.Client.Extensions.Options;
using Xunit;
using Xunit.Abstractions;

Expand Down Expand Up @@ -76,7 +78,12 @@ public async Task InitializeAsync()
var incomingMessagesQueue = await ServiceBusResourceProvider.BuildQueue(IncomingMessagesQueueName)
.CreateAsync();

var appSettings = GetWebApiAppSettings(incomingMessagesQueue.Name);
var processManagerTopic = await ServiceBusResourceProvider.BuildTopic("process-manager")
.CreateAsync();

var appSettings = GetWebApiAppSettings(
incomingMessagesQueue.Name,
processManagerTopic.Name);

B2CWebApiApplicationFactory.AppSettings = appSettings;

Expand Down Expand Up @@ -106,7 +113,7 @@ public void SetTestOutputHelper(ITestOutputHelper? testOutputHelper)
TestLogger.TestOutputHelper = testOutputHelper;
}

private Dictionary<string, string?> GetWebApiAppSettings(string incomingMessagesQueueName)
private Dictionary<string, string?> GetWebApiAppSettings(string incomingMessagesQueueName, string processManagerTopicName)
{
var dbConnectionString = DatabaseManager.ConnectionString;
if (!dbConnectionString.Contains("Trust")) // Trust Server Certificate might be required for some
Expand All @@ -124,7 +131,8 @@ public void SetTestOutputHelper(ITestOutputHelper? testOutputHelper)
{ "UserAuthentication:InternalMetadataAddress", OpenIdJwtManager.InternalMetadataAddress },
{ "UserAuthentication:BackendBffAppId", OpenIdJwtManager.TestBffAppId },
{ $"{ServiceBusNamespaceOptions.SectionName}:{nameof(ServiceBusNamespaceOptions.FullyQualifiedNamespace)}", ServiceBusResourceProvider.FullyQualifiedNamespace },
{ "IncomingMessages:QueueName", incomingMessagesQueueName },
{ $"{ProcessManagerServiceBusClientOptions.SectionName}:{nameof(ProcessManagerServiceBusClientOptions.TopicName)}", processManagerTopicName },
{ $"{IncomingMessagesQueueOptions.SectionName}:{nameof(IncomingMessagesQueueOptions.QueueName)}", incomingMessagesQueueName },
{ "OrchestrationsStorageAccountConnectionString", AzuriteManager.FullConnectionString },
{ "OrchestrationsTaskHubName", "EdiTest01" },
};
Expand Down

0 comments on commit 95a25f8

Please sign in to comment.