Skip to content

Commit

Permalink
Lint interaction model
Browse files Browse the repository at this point in the history
Lint the interaction model is valid JSON.
  • Loading branch information
martincostello committed Nov 28, 2024
1 parent 61af0f9 commit eae67aa
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions test/LondonTravel.Skill.Tests/InteractionModelTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.

using System.Text.Json;

namespace MartinCostello.LondonTravel.Skill;

public static class InteractionModelTests
{
[Fact]
public static async Task Interaction_Model_Is_Valid_Json()
{
// Arrange
var type = typeof(InteractionModelTests);
var assembly = type.Assembly;

using var model = assembly.GetManifestResourceStream(type.Namespace + ".interaction-model.json")!;
using var stream = new MemoryStream();

await model.CopyToAsync(stream);
model.Seek(0, SeekOrigin.Begin);

var reader = new Utf8JsonReader(stream.ToArray());

// Act
bool actual = JsonDocument.TryParseValue(ref reader, out _);

// Assert
actual.ShouldBeTrue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="testsettings.json;xunit.runner.json;Samples\*.json" CopyToOutputDirectory="PreserveNewest" />
<EmbeddedResource Include="..\LondonTravel.Skill.Tests\Bundles\*.json" />
<EmbeddedResource Include="..\LondonTravel.Skill.Tests\Bundles\*.json;..\..\static\interaction-model.json" />
</ItemGroup>
<ItemGroup>
<Using Include="Shouldly" />
Expand Down

0 comments on commit eae67aa

Please sign in to comment.