public void should_ignore_incorrect_codeRRContext() { var context = new ErrorReporterContext(this, new Exception()); var sut = new HttpHeadersProvider(); var result = sut.Collect(context); result.Should().BeNull(); }
public void should_not_return_an_empty_collection_when_the_header_collection_is_empty() { var httpContext = Substitute.For <HttpContextBase>(); var context = new AspNetContext(this, new Exception(), httpContext); httpContext.Request.Headers.Returns(new NameValueCollection()); var sut = new HttpHeadersProvider(); var result = sut.Collect(context); result.Should().BeNull(); }
public void should_include_url() { var httpContext = Substitute.For <HttpContextBase>(); var context = new AspNetContext(this, new Exception(), httpContext); httpContext.Request.Url.Returns(new Uri("http://localhost/majs")); httpContext.Request.Headers.Returns(new NameValueCollection()); var sut = new HttpHeadersProvider(); var result = sut.Collect(context); result.Property("Url").Should().Be("http://localhost/majs"); }
public void should_include_headers() { var httpContext = Substitute.For <HttpContextBase>(); var context = new AspNetContext(this, new Exception(), httpContext); var headers = new NameValueCollection { { "Host", "local" }, { "Server", "Awesome" } }; httpContext.Request.Headers.Returns(headers); var sut = new HttpHeadersProvider(); var result = sut.Collect(context); result.Property("Host").Should().Be("local"); result.Property("Server").Should().Be("Awesome"); }