Skip to content

Commit

Permalink
Merge pull request #32 from POORT8/feature/nb-253-sync-nb-public
Browse files Browse the repository at this point in the history
Sync merge.
  • Loading branch information
mabvanaartrijk authored Dec 16, 2024
2 parents c9a1496 + 0118ce4 commit 2a6715d
Show file tree
Hide file tree
Showing 96 changed files with 3,708 additions and 3,683 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,4 @@ FodyWeavers.xsd
**/Identity.db
**/Identity.db-shm
**/Identity.db-wal
**/http-client.env.json
24 changes: 11 additions & 13 deletions Poort8.Dataspace.API.Tests/OpenApiDefinitionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using Microsoft.Extensions.DependencyInjection;
using NSwag.Generation;
using Snapshooter.Xunit;
using System.Text.Json;
using System.Text.Json.Nodes;
using FluentAssertions.Json;
using Newtonsoft.Json.Linq;
using System.Text.Json.Serialization;

namespace Poort8.Dataspace.API.Tests;

Expand All @@ -19,18 +19,16 @@ public async Task TestApiDefinitionChangedUsingDoc()
var jsonNode = JsonNode.Parse(apiDefinition.ToJson());
var orderedApiDefinition = OrderApiDefinition(jsonNode!);

try
var serializerOptions = new JsonSerializerOptions
{
Snapshot.Match(orderedApiDefinition);
}
catch (Exception)
{
//On GitHub workflow Snapshot.Match fails, so try again with FluentAssertions
var snapshot = await File.ReadAllTextAsync("__snapshots__/OpenApiDefinitionTests.TestApiDefinitionChangedUsingDoc.snap");
var snapshotDoc = JToken.Parse(snapshot);
var apiDefinitionDoc = JToken.Parse(apiDefinition.ToJson());
apiDefinitionDoc.Should().BeEquivalentTo(snapshotDoc);
}
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
var jsonString = orderedApiDefinition!.ToJsonString(serializerOptions);

Snapshot.Match(jsonString
.Replace("\r\n", "\n")
.Replace("\\r\\n", "\\n"));
}

private static JsonNode? OrderApiDefinition(JsonNode? jsonNode)
Expand Down
10 changes: 5 additions & 5 deletions Poort8.Dataspace.API.Tests/Poort8.Dataspace.API.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -27,12 +27,12 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FastEndpoints.Testing" Version="5.26.0" />
<PackageReference Include="FastEndpoints.Testing" Version="5.31.0" />
<PackageReference Include="FluentAssertions.Json" Version="6.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Snapshooter.Xunit" Version="0.14.1" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading

0 comments on commit 2a6715d

Please sign in to comment.