public Task ItShouldContainGivenRequestMethod()
        {
            var routes = new RouteCollection();

            routes.MapOwinPath <AppDelegate>(string.Empty, WasCalledApp);
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost"), "DELTA"));

            Task task = ExecuteRequestContext(requestContext);

            return(task.ContinueWith(
                       _ =>
            {
                task.Exception.ShouldBe(null);
                WasCalled.ShouldBe(true);
                WasCalledInput.ShouldContainKeyAndValue("owin.RequestMethod", "DELTA");
            }));
        }
        public Task ItShouldHaveUnparsedAndEscapedQueryString()
        {
            var routes = new RouteCollection();

            routes.MapOwinPath <AppDelegate>(string.Empty, WasCalledApp);
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost/alpha/beta?gamma=delta&omega=%2fepsilon")));

            Task task = ExecuteRequestContext(requestContext);

            return(task.ContinueWith(
                       _ =>
            {
                task.Exception.ShouldBe(null);
                WasCalled.ShouldBe(true);
                WasCalledInput.ShouldContainKeyAndValue("owin.RequestQueryString", "gamma=delta&omega=%2fepsilon");
            }));
        }
        public Task ItShouldHaveEmptyPathBaseAndAbsolutePath()
        {
            var routes = new RouteCollection();

            routes.MapOwinPath <AppDelegate>(string.Empty, WasCalledApp);
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost/alpha/beta")));

            Task task = ExecuteRequestContext(requestContext);

            return(task.ContinueWith(
                       _ =>
            {
                task.Exception.ShouldBe(null);
                WasCalled.ShouldBe(true);
                WasCalledInput.ShouldContainKeyAndValue("owin.RequestPathBase", string.Empty);
                WasCalledInput.ShouldContainKeyAndValue("owin.RequestPath", "/alpha/beta");
            }));
        }
        public Task ItShouldContainRequestContextAndAnHttpContextBaseWhenCalledThroughRoute()
        {
            var routes = new RouteCollection();

            routes.MapOwinPath <AppDelegate>(string.Empty, WasCalledApp);
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost")));

            Task task = ExecuteRequestContext(requestContext);

            return(task.ContinueWith(
                       _ =>
            {
                task.Exception.ShouldBe(null);
                WasCalled.ShouldBe(true);
                WasCalledInput.ShouldContainKeyAndValue(typeof(RequestContext).FullName, requestContext);
                WasCalledInput.ShouldContainKey(typeof(HttpContextBase).FullName);
            }));
        }