/// <summary>
 /// Initializes a new instance of the <see cref="MethodDispatcher"/> class.
 /// </summary>
 /// <param name="application">The application.</param>
 public MethodDispatcher(Application application)
 {
     this.application = application;
     manager = application.ManagerFactory.GetManagerInstance();
     dispatcher = application.DispatcherFactory.GetDispatcherInstance();
     logger = application.LoggerFactory.GetLogger(GetType());
 }
        public void Validate(IControllerDispatcher dispatcher)
        {
            var ctrlrs = dispatcher.GetControllers(testUrl);
            Assert.AreEqual(testControllers.Length, ctrlrs.Length, "Controller queues lengths are different.");
            int i=0;
            foreach (var controllerInfo in ctrlrs)
            {
                Assert.AreEqual(controllerInfo.BindPoint.Controller.ControllerTypeName, testControllers[i],"Controller names are different at position: {0}",i);
                i++;
            }

            //TODO: Check whether right controllers are returned.
        }
        /// <summary>
        /// Test execution.
        /// </summary>
        /// <param name="test"></param>
        void realTest(object test)
        {
            #region Load part
            TestDescriptor descriptor = (TestDescriptor)test;

            Application.Initialize(initSh);

            application = Application.Instance;
            manager = application.ManagerFactory.GetManagerInstance();
            dispatcher = application.DispatcherFactory.GetDispatcherInstance();

            TestControllerManager testMgr = manager as TestControllerManager;
            Assert.IsNotNull(testMgr, "Invalid TestControllerManager");

            testMgr.LoadSpecial(descriptor.Controllers);
            #endregion


            #region Test part



            foreach (UrlControllersTest urlTest in descriptor.UrlTests)
            {
                urlTest.Validate(dispatcher);
            }

            #endregion
            
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DispatcherFactory"/> class.
 /// </summary>
 /// <param name="application">The application.</param>
 public DispatcherFactory(Application application, SectionHandler configuration)
 {
     this.application = application;
     instance = GetDispatcherImpl(application);
 }
        public void Validate(IControllerDispatcher dispatcher, int urlNumber)
        {
			Func<String, ControllerInvocationInfo, String> sumStr = (oldStr, invInfo) => oldStr += "+" + invInfo.BindPoint.Controller.ControllerTypeName;

            var ctrlrs = dispatcher.GetControllers(testUrl);

            if (!rootGroup.HasDuplicate)
                Assert.AreEqual(rootGroup.GetCount(), ctrlrs.Count, "Controller queues lengths are different. URL:{0}; Return Controllers:{1}, URL Number: {2} ", testUrl, ctrlrs.Aggregate(String.Empty, sumStr), urlNumber);

			int i = 0;
			foreach (var controllerInfo in ctrlrs)
			{
				Assert.IsTrue(rootGroup.ValidateNext(controllerInfo.BindPoint.Controller.ControllerTypeName), "Controller names are different at position: {0}; Controllers:{1}; URL Number: {2}", i,ctrlrs.Aggregate(String.Empty,sumStr), urlNumber);
				i++;
			}


		}