tests: don't reuse http client as fixture
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
namespace AnthropicClient.Tests.EndToEnd;
|
||||
|
||||
public class EndToEndTest(
|
||||
HttpClientFixture httpClientFixture,
|
||||
ConfigurationFixture configFixture
|
||||
) : IClassFixture<HttpClientFixture>, IClassFixture<ConfigurationFixture>
|
||||
public class EndToEndTest(ConfigurationFixture configFixture) : IClassFixture<ConfigurationFixture>
|
||||
{
|
||||
protected readonly AnthropicApiClient _client = new(configFixture.AnthropicApiKey, httpClientFixture.HttpClient);
|
||||
protected readonly AnthropicApiClient _client = new(configFixture.AnthropicApiKey, new());
|
||||
}
|
||||
@@ -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<string>.Success(value, requestId);
|
||||
var actual = AnthropicResult<string>.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<string>.Failure(error, requestId);
|
||||
var actual = AnthropicResult<string>.Failure(error, headers);
|
||||
|
||||
actual.IsSuccess.Should().BeFalse();
|
||||
actual.Error.Should().Be(error);
|
||||
actual.RequestId.Should().Be(requestId);
|
||||
actual.Headers.Should().Be(headers);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user