Пример #1
0
        public void Should_set_module_property_when_initialized()
        {
            // Given
            var module = new FakeNancyModuleWithBasePath();

            // When
            var rootBasedRoutes = new RouteDictionary(module, "GET");

            // Then
            rootBasedRoutes.Module.ShouldBeSameAs(module);
        }
Пример #2
0
        public void Should_store_route_combined_with_root_when_route_indexer_is_invoked_and_root_is_not_empty()
        {
            // Given
            var module = new FakeNancyModuleWithBasePath();
            var rootBasedRoutes = new RouteDictionary(module, "GET");
            rootBasedRoutes[this.path] = this.action;
            var moduleRelativePath = string.Concat(module.ModulePath, this.path);

            // When
            var description = rootBasedRoutes.GetRoute(moduleRelativePath);

            // Then
            description.Path.ShouldEqual(moduleRelativePath);
        }
Пример #3
0
        public void Should_add_leading_slash_to_route_if_missing()
        {
            // Given
            var moduleWithBasePath = new FakeNancyModuleWithBasePath();

            // When
            moduleWithBasePath.Get["test"] = d => null;

            // Then
            moduleWithBasePath.Routes.Last().Description.Path.ShouldEqual("/fake/test");
        }
Пример #4
0
        public void Should_store_route_combine_with_base_path_if_one_specified()
        {
            // Given
            var moduleWithBasePath = new FakeNancyModuleWithBasePath();

            // When
            moduleWithBasePath.Get["/NewRoute"] = d => null;

            // Then
            moduleWithBasePath.Routes.Last().Description.Path.ShouldEqual("/fake/NewRoute");
        }
Пример #5
0
        public void Should_store_route_combine_with_base_path_if_one_specified()
        {
            // Given
            var moduleWithBasePath = new FakeNancyModuleWithBasePath();

            // When
            moduleWithBasePath.Get("/NewRoute", args => Task.FromResult<object>(null));

            // Then
            moduleWithBasePath.Routes.Last().Description.Path.ShouldEqual("/fake/NewRoute");
        }