tests: adding missing tests for newly introduced classes
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class Base64SourceTests
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_WhenCalledWithValidArguments_ItShouldSetProperties()
|
||||
{
|
||||
var mediaType = "application/pdf";
|
||||
var data = "base64data";
|
||||
|
||||
var source = new Base64Source(mediaType, data);
|
||||
|
||||
source.MediaType.Should().Be(mediaType);
|
||||
source.Data.Should().Be(data);
|
||||
source.Type.Should().Be("base64");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalledWithNullMediaType_ItShouldThrowArgumentNullException()
|
||||
{
|
||||
string? mediaType = null;
|
||||
var data = "base64data";
|
||||
|
||||
var action = () => new Base64Source(mediaType!, data);
|
||||
|
||||
action.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalledWithNullData_ItShouldThrowArgumentNullException()
|
||||
{
|
||||
var mediaType = "application/pdf";
|
||||
string? data = null;
|
||||
|
||||
var action = () => new Base64Source(mediaType, data!);
|
||||
|
||||
action.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class CharacterLocationCitationTests
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ItShouldSetProperties()
|
||||
{
|
||||
var result = new CharacterLocationCitation();
|
||||
|
||||
result.Type.Should().Be("char_location");
|
||||
result.CitedText.Should().BeEmpty();
|
||||
result.DocumentIndex.Should().Be(0);
|
||||
result.DocumentTitle.Should().BeEmpty();
|
||||
result.StartCharIndex.Should().Be(0);
|
||||
result.EndCharIndex.Should().Be(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class CitationDeltaTests
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ItShouldSetProperties()
|
||||
{
|
||||
var result = new CitationDelta();
|
||||
|
||||
result.Type.Should().Be("citations_delta");
|
||||
result.Citation.Should().BeEquivalentTo(new CharacterLocationCitation());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalledWithCitation_ItShouldSetProperties()
|
||||
{
|
||||
var citation = new ContentBlockLocationCitation();
|
||||
var result = new CitationDelta(citation);
|
||||
|
||||
result.Type.Should().Be("citations_delta");
|
||||
result.Citation.Should().BeSameAs(citation);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenCalledWithNullCitation_ItShouldThrowException()
|
||||
{
|
||||
var act = () => new CitationDelta(null!);
|
||||
|
||||
act.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class CitationOptionTests
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ItShouldSetProperties()
|
||||
{
|
||||
var result = new CitationOption();
|
||||
|
||||
result.Enabled.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class CitationTypeTests
|
||||
{
|
||||
[Fact]
|
||||
public void ContentBlockLocation_WhenCalled_ItShouldReturnCorrectValue()
|
||||
{
|
||||
CitationType.ContentBlockLocation.Should().Be("content_block_location");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CharacterLocation_WhenCalled_ItShouldReturnCorrectValue()
|
||||
{
|
||||
CitationType.CharacterLocation.Should().Be("char_location");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PageLocation_WhenCalled_ItShouldReturnCorrectValue()
|
||||
{
|
||||
CitationType.PageLocation.Should().Be("page_location");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace AnthropicClient.Tests.Unit.Models;
|
||||
|
||||
public class ContentBlockLocationCitationTests
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_WhenCalled_ItShouldSetProperties()
|
||||
{
|
||||
var result = new ContentBlockLocationCitation();
|
||||
|
||||
result.Type.Should().Be("content_block_location");
|
||||
result.CitedText.Should().BeEmpty();
|
||||
result.DocumentIndex.Should().Be(0);
|
||||
result.DocumentTitle.Should().BeEmpty();
|
||||
result.StartBlockIndex.Should().Be(0);
|
||||
result.EndBlockIndex.Should().Be(0);
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,14 @@ public class ContentDeltaTypeTests
|
||||
|
||||
actual.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CitationDelta_WhenCalled_ItShouldReturnExpectedValue()
|
||||
{
|
||||
var expected = "citations_delta";
|
||||
|
||||
var actual = ContentDeltaType.CitationDelta;
|
||||
|
||||
actual.Should().Be(expected);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user