示例#1
0
        public void Should_set_path_on_descriptions_that_are_passed_to_resolver()
        {
            // Given
            var request = new Request("POST", "/", new Dictionary<string, IEnumerable<string>>(), new MemoryStream());

            var r = new FakeRouteResolver();
            var e = new NancyEngine(this.locator, r);

            A.CallTo(() => this.locator.GetModules()).Returns(this.modules);

            // When
            e.HandleRequest(request);

            // Then
            r.Path.ShouldEqual("/");
        }
示例#2
0
        public void Should_set_path_on_descriptions_that_are_passed_to_resolver()
        {
            // Given
            var request = new Request("POST", "/");

            var r = new FakeRouteResolver();
            var e = new NancyEngine( r, this.application);

            A.CallTo(() => this.application.ModuleMetas).Returns(this.modules);

            // When
            e.HandleRequest(request);

            // Then
            r.Path.ShouldEqual("/");
        }
示例#3
0
        public void Should_set_action_on_descriptions_that_are_passed_to_resolver()
        {
            // Given
            var request = new Request("POST", "/", new Dictionary<string, IEnumerable<string>>(), new MemoryStream());

            var r = new FakeRouteResolver();
            var e = new NancyEngine(this.locator, r);

            A.CallTo(() => this.locator.GetModules()).Returns(this.modules);

            var expectedAction =
                (new FakeNancyModuleWithBasePath()).Post["/"];

            // When
            e.HandleRequest(request);

            // Then
            r.Action.ShouldBeSameAs(expectedAction);
        }
示例#4
0
        public void Should_set_base_route_on_descriptions_that_are_passed_to_resolver()
        {
            // Given
            var request = new Request("POST", "/");

            var r = new FakeRouteResolver();
            var e = new NancyEngine(this.locator, r);

            A.CallTo(() => this.locator.GetModules()).Returns(this.modules);

            // When
            e.HandleRequest(request);

            // Then
            r.ModulePath.ShouldEqual("/fake");
        }