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
@@ -1,7 +1,13 @@
namespace AnthropicClient.Tests.Unit.Models;
public class TextSourceTests
public class TextSourceTests : SerializationTest
{
private readonly string _testJson = @"{
""type"": ""text"",
""media_type"": ""text/plain"",
""data"": ""data""
}";
[Fact]
public void Constructor_WhenCalled_ItShouldSetProperties()
{
@@ -11,4 +17,25 @@ public class TextSourceTests
result.MediaType.Should().Be("text/plain");
result.Data.Should().Be("data");
}
[Fact]
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
{
var source = new TextSource("data");
var result = Serialize<Source>(source);
JsonAssert.Equal(_testJson, result);
}
[Fact]
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedShape()
{
var source = Deserialize<Source>(_testJson);
var textSource = source.As<TextSource>();
textSource!.Type.Should().Be("text");
textSource.MediaType.Should().Be("text/plain");
textSource.Data.Should().Be("data");
}
}