Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -30,7 +30,8 @@ public sealed class IdempotencyMiddlewareTests
|
||||
config["Scanner:Idempotency:Window"] = "24:00:00";
|
||||
});
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task PostRequest_WithContentDigest_ReturnsIdempotencyKey()
|
||||
{
|
||||
// Arrange
|
||||
@@ -50,7 +51,8 @@ public sealed class IdempotencyMiddlewareTests
|
||||
Assert.NotEqual(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task DuplicateRequest_WithSameContentDigest_ReturnsCachedResponse()
|
||||
{
|
||||
// Arrange
|
||||
@@ -75,7 +77,8 @@ public sealed class IdempotencyMiddlewareTests
|
||||
Assert.NotEqual(HttpStatusCode.InternalServerError, response2.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task DifferentRequests_WithDifferentDigests_AreProcessedSeparately()
|
||||
{
|
||||
// Arrange
|
||||
@@ -100,7 +103,8 @@ public sealed class IdempotencyMiddlewareTests
|
||||
Assert.NotEqual(HttpStatusCode.InternalServerError, response2.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetRequest_BypassesIdempotencyMiddleware()
|
||||
{
|
||||
// Arrange
|
||||
@@ -114,13 +118,15 @@ public sealed class IdempotencyMiddlewareTests
|
||||
Assert.NotEqual(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task PostRequest_WithoutContentDigest_ComputesDigest()
|
||||
{
|
||||
// Arrange
|
||||
await using var factory = CreateFactory();
|
||||
using var client = factory.CreateClient();
|
||||
|
||||
using StellaOps.TestKit;
|
||||
var content = new StringContent("""{"test":"nodigest"}""", Encoding.UTF8, "application/json");
|
||||
// Not adding Content-Digest header - middleware should compute it
|
||||
|
||||
|
||||
Reference in New Issue
Block a user