public async void ProxyAuthenticationRequiredShouldSetStatusCodeCorrectly() { // Arrange const string fakeHeaderValue = @"Basic realm=""proxy.com"""; var fakeContext = this.CreateFakeActionContext(); var result = new ProxyAuthenticationRequiredResult(fakeHeaderValue); // Act await result.ExecuteResultAsync(fakeContext); // Assert Assert.Equal(StatusCodes.Status407ProxyAuthenticationRequired, fakeContext.HttpContext.Response.StatusCode); }
public async void ProxyAuthenticationRequiredShouldSetHeaderCorrectly() { // Arrange const string fakeHeaderValue = @"Basic realm=""proxy.com"""; var fakeContext = this.CreateFakeActionContext(); var result = new ProxyAuthenticationRequiredResult(fakeHeaderValue); // Act await result.ExecuteResultAsync(fakeContext); // Assert var proxyAuthHeader = fakeContext.HttpContext.Response.Headers.FirstOrDefault(x => x.Key == HeaderNames.ProxyAuthenticate); Assert.NotNull(proxyAuthHeader); Assert.Equal(fakeHeaderValue, proxyAuthHeader.Value); }