Summary
Several tests in the test suite make real HTTP requests to external services like jsonplaceholder.typicode.com and fakestoreapi.com. This makes the tests unreliable (flaky) in CI environments and when running offline.
Problems
- Tests fail if the external service is down or rate-limits the CI runner
- Test execution is slow due to network latency
- Not suitable for deterministic, offline test runs
Affected Test Files
StaticMethodsTests.cs
NexarTest.cs
ContentTypeTests.cs
RetryMechanismTests.cs
Proposed Solution
Replace external HTTP calls with a local mock HTTP server using Microsoft.AspNetCore.TestHost or a library like WireMock.Net.
// Example with WireMock.Net
var server = WireMockServer.Start();
server.Given(Request.Create().WithPath("/posts/1").UsingGet())
.RespondWith(Response.Create().WithStatusCode(200).WithBodyAsJson(new { id = 1 }));
Summary
Several tests in the test suite make real HTTP requests to external services like
jsonplaceholder.typicode.comandfakestoreapi.com. This makes the tests unreliable (flaky) in CI environments and when running offline.Problems
Affected Test Files
StaticMethodsTests.csNexarTest.csContentTypeTests.csRetryMechanismTests.csProposed Solution
Replace external HTTP calls with a local mock HTTP server using
Microsoft.AspNetCore.TestHostor a library likeWireMock.Net.