From 6caa4b1b069bf773d034d5f2aa7fa68f07a6dfb9 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sat, 29 Jun 2024 09:49:15 -0500 Subject: [PATCH] tests: don't reuse http client as fixture --- .../EndToEnd/AnthropicApiClientTests.cs | 5 +---- tests/AnthropicClient.Tests/EndToEnd/EndToEndTest.cs | 7 ++----- .../Unit/Models/AnthropicResultTests.cs | 12 ++++++------ 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs b/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs index fe5560c..f56d165 100644 --- a/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs +++ b/tests/AnthropicClient.Tests/EndToEnd/AnthropicApiClientTests.cs @@ -1,9 +1,6 @@ namespace AnthropicClient.Tests.EndToEnd; -public class ClientTests( - HttpClientFixture httpClientFixture, - ConfigurationFixture configFixture -) : EndToEndTest(httpClientFixture, configFixture) +public class ClientTests(ConfigurationFixture configFixture) : EndToEndTest(configFixture) { [Fact] public async Task CreateChatMessage_WhenCalled_ItShouldReturnChatResponse() diff --git a/tests/AnthropicClient.Tests/EndToEnd/EndToEndTest.cs b/tests/AnthropicClient.Tests/EndToEnd/EndToEndTest.cs index b4cc22d..6e9b19b 100644 --- a/tests/AnthropicClient.Tests/EndToEnd/EndToEndTest.cs +++ b/tests/AnthropicClient.Tests/EndToEnd/EndToEndTest.cs @@ -1,9 +1,6 @@ namespace AnthropicClient.Tests.EndToEnd; -public class EndToEndTest( - HttpClientFixture httpClientFixture, - ConfigurationFixture configFixture -) : IClassFixture, IClassFixture +public class EndToEndTest(ConfigurationFixture configFixture) : IClassFixture { - protected readonly AnthropicApiClient _client = new(configFixture.AnthropicApiKey, httpClientFixture.HttpClient); + protected readonly AnthropicApiClient _client = new(configFixture.AnthropicApiKey, new()); } \ No newline at end of file diff --git a/tests/AnthropicClient.Tests/Unit/Models/AnthropicResultTests.cs b/tests/AnthropicClient.Tests/Unit/Models/AnthropicResultTests.cs index 715e03a..fa02473 100644 --- a/tests/AnthropicClient.Tests/Unit/Models/AnthropicResultTests.cs +++ b/tests/AnthropicClient.Tests/Unit/Models/AnthropicResultTests.cs @@ -6,25 +6,25 @@ public class AnthropicResultTests public void Success_WhenCalled_ItShouldReturnSuccessResult() { var value = "success"; - var requestId = Guid.NewGuid().ToString(); + var headers = new AnthropicHeaders(); - var actual = AnthropicResult.Success(value, requestId); + var actual = AnthropicResult.Success(value, headers); actual.IsSuccess.Should().BeTrue(); actual.Value.Should().Be(value); - actual.RequestId.Should().Be(requestId); + actual.Headers.Should().Be(headers); } [Fact] public void Failure_WhenCalled_ItShouldReturnFailureResult() { var error = new AnthropicError(new AuthenticationError("message")); - var requestId = Guid.NewGuid().ToString(); + var headers = new AnthropicHeaders(); - var actual = AnthropicResult.Failure(error, requestId); + var actual = AnthropicResult.Failure(error, headers); actual.IsSuccess.Should().BeFalse(); actual.Error.Should().Be(error); - actual.RequestId.Should().Be(requestId); + actual.Headers.Should().Be(headers); } } \ No newline at end of file