public async Task ExecuteAsync_ChangeOutput_ReturnsModifiedOutput() { var middleware = new PostProcessingMiddleware <Calculate, int>( new[] { new UseConstantValue() }, null ); var handler = (IQueryHandler <Calculate, int>) new SyncCalculateHandler(); var query = new Calculate(); var result = await middleware.ExecuteAsync( new Calculate(), () => handler.HandleAsync(query, default), default ); result.Should().Be(UseConstantValue.Value); }
public async Task ExecuteAsync_UseSortingAndChangeOutput_ReturnsModifiedOutput() { var middleware = new PostProcessingMiddleware <Calculate, int>( new IQueryPostProcessor <Calculate, int>[] { new DoubleOutput(), new DoubleOutput(), new UseConstantValue() }, new OrderComparer <Calculate, int>() ); var handler = (IQueryHandler <Calculate, int>) new SyncCalculateHandler(); var query = new Calculate(); var result = await middleware.ExecuteAsync( query, () => handler.HandleAsync(query, default), default ); result.Should().Be(UseConstantValue.Value * 4); }