diff --git a/tests/AnthropicClient.Tests/AnthropicClient.Tests.csproj b/tests/AnthropicClient.Tests/AnthropicClient.Tests.csproj
index 0370ec0..c5ad00c 100644
--- a/tests/AnthropicClient.Tests/AnthropicClient.Tests.csproj
+++ b/tests/AnthropicClient.Tests/AnthropicClient.Tests.csproj
@@ -54,5 +54,11 @@
PreserveNewest
+
+
+
+ PreserveNewest
+
+
diff --git a/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs b/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs
index 03b6775..0a62504 100644
--- a/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs
+++ b/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs
@@ -56,4 +56,41 @@ public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(conf
}
}
}
+
+ [Fact]
+ public async Task CreateMessageAsync_WhenImageIsSent_ItShouldReturnResponse()
+ {
+ var imagePath = Path.Combine(Directory.GetCurrentDirectory(), "Files", "elephant.jpg");
+ var mediaType = "image/jpeg";
+ var imageBytes = await File.ReadAllBytesAsync(imagePath);
+ var base64Image = Convert.ToBase64String(imageBytes);
+
+ var request = new MessageRequest(
+ model: AnthropicModels.Claude3Haiku,
+ messages: [
+ new(MessageRole.User, [
+ new ImageContent(mediaType, base64Image),
+ new TextContent("What is in this image?")
+ ]),
+ ]
+ );
+
+ var result = await _client.CreateMessageAsync(request);
+
+ result.IsSuccess.Should().BeTrue();
+ result.Value.Should().BeOfType();
+ result.Value.Content.Should().NotBeNullOrEmpty();
+
+ var text = result.Value.Content.Aggregate("", (acc, content) =>
+ {
+ if (content is TextContent textContent)
+ {
+ acc += textContent.Text;
+ }
+
+ return acc;
+ });
+
+ text.Should().Contain("elephant");
+ }
}
\ No newline at end of file
diff --git a/tests/AnthropicClient.Tests/Files/elephant.jpg b/tests/AnthropicClient.Tests/Files/elephant.jpg
new file mode 100644
index 0000000..edda03e
Binary files /dev/null and b/tests/AnthropicClient.Tests/Files/elephant.jpg differ