tests: add additional test coverage

This commit is contained in:
Stevan Freeborn
2025-07-08 21:56:13 -05:00
parent 598eaaad94
commit 2732ae2b21
7 changed files with 198 additions and 10 deletions
@@ -0,0 +1,31 @@
namespace AnthropicClient.Tests.Unit.Json;
public class SourceConverterTests : SerializationTest
{
[Fact]
public void JsonDeserialization_WhenTypeIsUnknown_ItThrowsException()
{
var json = @"{ ""type"": ""unknown"" }";
var action = () => Deserialize<Source>(json);
action.Should().Throw<JsonException>();
}
[Fact]
public void JsonSerialization_WhenSourceIsNotKnown_ItShouldHaveExpectedShape()
{
var source = new TestSource();
var result = Serialize<Source>(source);
JsonAssert.Equal(@"{ ""type"": ""test"" }", result);
}
private class TestSource : Source
{
public TestSource() : base("test")
{
}
}
}