diff --git a/test/LondonTravel.Skill.Tests/InteractionModelTests.cs b/test/LondonTravel.Skill.Tests/InteractionModelTests.cs new file mode 100644 index 00000000..01d53b9e --- /dev/null +++ b/test/LondonTravel.Skill.Tests/InteractionModelTests.cs @@ -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(); + } +} diff --git a/test/LondonTravel.Skill.Tests/LondonTravel.Skill.Tests.csproj b/test/LondonTravel.Skill.Tests/LondonTravel.Skill.Tests.csproj index 50b734ce..f7a5068e 100644 --- a/test/LondonTravel.Skill.Tests/LondonTravel.Skill.Tests.csproj +++ b/test/LondonTravel.Skill.Tests/LondonTravel.Skill.Tests.csproj @@ -26,7 +26,7 @@ - +