public void CreateController_DecoratedWithViewEnhanceViewEnginesAttribute_NewControllersViewEnginesHaveCustomTransformations()
        {
            //Arrange
            var controllerFactory = new FrontendControllerFactory();

            controllerFactory.RegisterController(typeof(DummyEnhancedController).Name, typeof(DummyEnhancedController));

            var viewEngine = new RazorViewEngine();

            ViewEngines.Engines.Add(viewEngine);
            try
            {
                //Act
                var controller = (Controller)controllerFactory.CreateController(new DummyHttpContext().Request.RequestContext, "DummyEnhanced");

                //Assert
                var controllerVe = controller.ViewEngineCollection.OfType <RazorViewEngine>().FirstOrDefault();
                Assert.IsNotNull(controllerVe, "The newly created controller does not have the expected view engine.");

                Assert.IsTrue(controllerVe.ViewLocationFormats.Any(p => p.StartsWith("~/" + DummyEnhancedController.CustomControllerPath)),
                              "The newly created controller does not have its custom path in the view locations.");
            }
            finally
            {
                ViewEngines.Engines.Remove(viewEngine);
            }
        }
        public void CreateController_DummyController_NewControllerViewEnginesHaveAdditinalSearchPaths()
        {
            //Arrange
            var controllerFactory = new FrontendControllerFactory();

            controllerFactory.RegisterController(typeof(DummyController).Name, typeof(DummyController));

            var viewEngine = new RazorViewEngine();

            ViewEngines.Engines.Add(viewEngine);
            try
            {
                //Act
                var controller = (Controller)controllerFactory.CreateController(new DummyHttpContext().Request.RequestContext, "Dummy");

                //Assert
                var controllerVe = controller.ViewEngineCollection.OfType <RazorViewEngine>().FirstOrDefault();
                Assert.IsNotNull(controllerVe, "The newly created controller does not have the expected view engine.");

                var containerVp = "~/" + FrontendManager.VirtualPathBuilder.GetVirtualPath(typeof(DummyController).Assembly);
                Assert.IsTrue(controllerVe.ViewLocationFormats.Any(v => v.StartsWith(containerVp)),
                              "The newly created controller does not have its container path in the view locations.");
            }
            finally
            {
                ViewEngines.Engines.Remove(viewEngine);
            }
        }