Skip to content

Commit

Permalink
fix: fixed failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianKuesters committed Jun 25, 2024
1 parent a468ea2 commit 188caf3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public QueryEndpointBaseTests(WebApplicationFactory<Program> factory)
}

[Fact]
public async Task CommandEndpointBase_ShouldAddDependenciesFromQueryRequest()
public async Task QueryEndpointBase_ShouldAddDependenciesFromQueryRequest()
{
// Arrange
var serviceCollection = new ServiceCollection();
Expand All @@ -48,11 +48,10 @@ public async Task CommandEndpointBase_ShouldAddDependenciesFromQueryRequest()
});

// Act
// ToDo: fix this test
await endpoint.HandleAsync(queryRequest, CancellationToken.None);

// Assert
LogTestContextCommandHandler.LogHistory.Should().ContainSingle().Which.UserId.Should().Be(testContext.UserId);
RequestTestContextQueryHandler.ContextHistory.Should().ContainSingle().Which.UserId.Should().Be(testContext.UserId);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ namespace Wemogy.CQRS.Extensions.FastEndpoints.UnitTests.TestApplication.Queries

public class RequestTestContextQueryHandler : IQueryHandler<RequestTestContextQuery, TestContext>
{
public static readonly Stack<TestContext> ContextHistory = new Stack<TestContext>();

private readonly TestContext _testContext;

public RequestTestContextQueryHandler(TestContext testContext)
Expand All @@ -14,6 +16,7 @@ public RequestTestContextQueryHandler(TestContext testContext)

public Task<TestContext> HandleAsync(RequestTestContextQuery query, CancellationToken cancellationToken)
{
ContextHistory.Push(_testContext);
return Task.FromResult(_testContext);
}
}

0 comments on commit 188caf3

Please sign in to comment.