AddController() public method

Register a controller on the tree. If the specified area name matches the current node, the controller is register on the node itself, otherwise on the right or on the left node.
Note that the controller is an object. That allows different implementation of a controller factory to register different representation of what a controller is (a name, a descriptor etc)
public AddController ( String areaName, String controllerName, Type controller ) : void
areaName String The area name, or String.Empty
controllerName String The controller name
controller System.Type The controller representation
return void
		public void EmptyArea()
		{
			DefaultControllerTree tree = new DefaultControllerTree();
			tree.AddController("", "home", typeof(HomeController));
			tree.AddController("", "contact", typeof(ContactController));
			tree.AddController("", "cart", typeof(CartController));

			Assert.AreEqual( typeof(HomeController), tree.GetController("", "home") );
			Assert.AreEqual( typeof(ContactController), tree.GetController("", "contact") );
			Assert.AreEqual( typeof(CartController), tree.GetController("", "cart") );
		}
		public void AddingController_RaisesNotifcationEvent() 
		{
			DefaultControllerTree tree = new DefaultControllerTree();
			bool eventRaised = false;
			tree.ControllerAdded += delegate { eventRaised = true; };
			tree.AddController("clients","home",typeof(ClientHomeController));
			Assert.IsTrue(eventRaised);
		}
        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));
            }
        }
		public void FewAreas()
		{
			DefaultControllerTree tree = new DefaultControllerTree();

			tree.AddController("", "home", typeof(HomeController));
			tree.AddController("", "contact", typeof(ContactController));
			tree.AddController("", "cart", typeof(CartController));
			tree.AddController("clients", "home", typeof(ClientHomeController));
			tree.AddController("clients", "contact", typeof(ClientContactController));
			tree.AddController("clients", "cart", typeof(ClientCartController));
			tree.AddController("lists", "home", typeof(ListController));

			Assert.AreEqual( typeof(HomeController), tree.GetController("", "home") );
			Assert.AreEqual( typeof(ContactController), tree.GetController("", "contact") );
			Assert.AreEqual( typeof(CartController), tree.GetController("", "cart") );

			Assert.AreEqual( typeof(ClientHomeController), tree.GetController("clients", "home") );
			Assert.AreEqual( typeof(ClientContactController), tree.GetController("clients", "contact") );
			Assert.AreEqual( typeof(ClientCartController), tree.GetController("clients", "cart") );

			Assert.AreEqual( typeof(ListController), tree.GetController("lists", "home") );
		}