From 676f10b8322d92201fd8e93afa618031a8a9ba31 Mon Sep 17 00:00:00 2001 From: Maciej Zieniuk Date: Fri, 8 Nov 2024 15:29:51 +0000 Subject: [PATCH] PM-10600: HttpClientFactory fixture returns the same HttpClient instance. The IHttpClientFactory.CreateClient(string name) needs to return different HttpClient instances in case there are multiple clients to be created. This have been issue for BaseIdentityClientService where the HttpClient is modified with BaseAddress, causing issues. --- test/Core.Test/AutoFixture/HttpClientFixtures.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Core.Test/AutoFixture/HttpClientFixtures.cs b/test/Core.Test/AutoFixture/HttpClientFixtures.cs index 55dd5c6e6..2b97de752 100644 --- a/test/Core.Test/AutoFixture/HttpClientFixtures.cs +++ b/test/Core.Test/AutoFixture/HttpClientFixtures.cs @@ -18,7 +18,7 @@ public class HttpClientFactoryBuilder : ISpecimenBuilder { var handler = context.Create(); var httpClientFactory = Substitute.For(); - httpClientFactory.CreateClient(Arg.Any()).Returns(handler.ToHttpClient()); + httpClientFactory.CreateClient(Arg.Any()).Returns(_ => handler.ToHttpClient()); return httpClientFactory; }