namespace AnthropicClient.Tests.Integration; public class IntegrationTest { protected readonly MockHttpMessageHandler _mockHttpMessageHandler = new(); protected AnthropicApiClient Client => CreateClient(); private AnthropicApiClient CreateClient() { return new AnthropicApiClient("test-key", _mockHttpMessageHandler.ToHttpClient()); } } public static class MockHttpMessageHandlerExtensions { private static MockedRequest SetupBaseRequest(this MockHttpMessageHandler mockHttpMessageHandler) { return mockHttpMessageHandler .When(HttpMethod.Post, "https://api.anthropic.com/v1/messages") .WithHeaders(new Dictionary { { "anthropic-version", "2023-06-01" }, { "x-api-key", "test-key" } }); } public static MockedRequest WhenCreateMessageRequest(this MockHttpMessageHandler mockHttpMessageHandler) { return mockHttpMessageHandler .SetupBaseRequest() .WithJsonContent(r => r.Stream == false); } public static MockedRequest WhenCreateStreamMessageRequest(this MockHttpMessageHandler mockHttpMessageHandler) { return mockHttpMessageHandler .SetupBaseRequest() .WithJsonContent(r => r.Stream == true); } }