feat: create chat message
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class TextContentTests : SerializationTest
|
||||
{
|
||||
private readonly string _testJson = @"{ ""text"": ""text"", ""type"": ""text"" }";
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ItShouldInitializeText()
|
||||
{
|
||||
var expectedText = "text";
|
||||
|
||||
var result = new TextContent(expectedText);
|
||||
|
||||
result.Text.Should().Be(expectedText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalledAndTextIsNull_ItShouldThrowArgumentNullException()
|
||||
{
|
||||
var action = () => new TextContent(null!);
|
||||
|
||||
action.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void JsonSerialization_WhenSerialized_ItShouldHaveExpectedShape()
|
||||
{
|
||||
var content = new TextContent("text");
|
||||
|
||||
var actual = Serialize(content);
|
||||
|
||||
JsonAssert.Equal(_testJson, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void JsonDeserialization_WhenDeserialized_ItShouldHaveExpectedShape()
|
||||
{
|
||||
var expected = new TextContent("text");
|
||||
|
||||
var actual = Deserialize<TextContent>(_testJson);
|
||||
|
||||
actual.Should().BeEquivalentTo(expected);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user