public void Should_add_the_expected_http_header_to_the_request() { // Arrange var middleware = new AddResponseHeaderMiddlewareFake(null); // Act var result = middleware.InvokeAsync(_contextMock.Object); // Assert _headersMock.Verify( x => x.Add(AddResponseHeaderMiddlewareFake.FakeHeaderName, AddResponseHeaderMiddlewareFake.FakeValue), Times.Once, failMessage: $"Should add the header {AddResponseHeaderMiddlewareFake.FakeHeaderName} with value {AddResponseHeaderMiddlewareFake.FakeValue}." ); }
public void Should_not_add_a_http_header_to_the_request_when_ProcessRequest_return_false() { // Arrange var middleware = new AddResponseHeaderMiddlewareFake( null, processRequest: false ); // Act var result = middleware.InvokeAsync(_contextMock.Object); // Assert _headersMock.Verify( x => x.Add(AddResponseHeaderMiddlewareFake.FakeHeaderName, AddResponseHeaderMiddlewareFake.FakeValue), Times.Never, failMessage: $"Should not add the header {AddResponseHeaderMiddlewareFake.FakeHeaderName} with value {AddResponseHeaderMiddlewareFake.FakeValue}." ); }