Пример #1
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");
        }
Пример #2
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");
        }