public void ControllerAddedToTree(object sender, ControllerAddedEventArgs args)
        {
            //If in a virtual directory I need to prepend a slash

            string url = args.Area + "/" + args.ControllerName + ".rails";

            urlTokenizer.AddDefaultRule(url, args.Area, args.ControllerName, "collection");
            urlTokenizer.AddDefaultRule("/" + url, args.Area, args.ControllerName, "collection");
        }
Ejemplo n.º 2
0
        public void Should_AddTwoUrls_WhenControllerAddedToTree()
        {
            MockRepository mocks = new MockRepository();

            IUrlTokenizer   tokenizer      = mocks.DynamicMock <IUrlTokenizer>();
            IControllerTree controllerTree = new DefaultControllerTree();

            StubServiceProvider serviceProvider = new StubServiceProvider(tokenizer, controllerTree);

            DefaultUrlProvider provider = new DefaultUrlProvider();

            provider.Service(serviceProvider);

            using (mocks.Record())
            {
                tokenizer.AddDefaultRule("area/controller.rails", "area", "controller", "collection");
                tokenizer.AddDefaultRule("/area/controller.rails", "area", "controller", "collection");
            }

            using (mocks.Playback())
            {
                controllerTree.AddController("area", "controller", typeof(SampleRestController));
            }
        }