From e52540eec3eefe97c1d6bbffc876c79aed6e0340 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sat, 12 Jul 2025 22:13:10 -0500 Subject: [PATCH] tests: add end to end test --- .../EndToEnd/AnthropicApiClientTests.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs b/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs index cb1b9fe..1b85111 100644 --- a/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs +++ b/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs @@ -687,4 +687,25 @@ public class AnthropicApiClientTests(ConfigurationFixture configFixture) : EndTo result.Value.Id.Should().Be(createResult.Value.Id); result.Value.ProcessingStatus.Should().Be(MessageBatchStatus.Canceling); } + + [Fact] + public async Task CreateFileAsync_WhenCalled_ItShouldReturnResponse() + { + var fileName = "story.txt"; + var fileType = "text/plain"; + var filePath = TestFileHelper.GetTestFilePath("story.txt"); + var fileContent = await File.ReadAllBytesAsync(filePath); + var request = new CreateFileRequest(fileContent, fileName, fileType); + + var httpClient = new HttpClient(); + httpClient.DefaultRequestHeaders.Add("anthropic-beta", "files-api-2025-04-14"); + var client = CreateClient(httpClient); + + var result = await client.CreateFileAsync(request); + + result.IsSuccess.Should().BeTrue(); + result.Value.Should().BeOfType(); + result.Value.Name.Should().Be(fileName); + result.Value.MimeType.Should().Be(fileType); + } } \ No newline at end of file