Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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");
        }
Exemplo n.º 4
0
        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");
        }