public void GetTemplateFramework_SpecificFremework_ReturnsCorrectFramework()
        {
            DummyFrameworkSpecificPageTemplate pTemplate = new DummyFrameworkSpecificPageTemplate(PageTemplateFramework.Mvc);
            var framework = pTemplate.GetTemplateFramework();

            Assert.AreEqual(PageTemplateFramework.Mvc, framework);
        }
Exemplo n.º 2
0
        public void GetVirtualPath_HybridModeTemplate_ReturnsEmptyVirtualPath()
        {
            //Arrange
            LayoutResolver resolver = new LayoutResolver();
            DummyFrameworkSpecificPageTemplate dummyPageTemplate = new DummyFrameworkSpecificPageTemplate(PageTemplateFramework.Hybrid);

            //Act
            var resolvedVirtualPath = resolver.GetVirtualPath(dummyPageTemplate);

            //Assert
            Assert.IsNull(resolvedVirtualPath, "The resolved virtual path should be null when the page template is not in MVC mode.");
        }
Exemplo n.º 3
0
        public void GetVirtualPath_IPageTemplate_ReturnsNull()
        {
            //Arrange
            LayoutResolver resolver = new LayoutResolver();
            DummyFrameworkSpecificPageTemplate dummyPageTemplate = new DummyFrameworkSpecificPageTemplate(PageTemplateFramework.Mvc);

            using (var objFactory = new ObjectFactoryContainerRegion())
            {

                ObjectFactory.Container.RegisterType<ConfigManager, ConfigManager>(typeof(XmlConfigProvider).Name.ToUpperInvariant(),
                    new InjectionConstructor(typeof(XmlConfigProvider).Name));
                ObjectFactory.Container.RegisterType<XmlConfigProvider, DummyConfigProvider>();
                Config.RegisterSection<VirtualPathSettingsConfig>();
                Config.RegisterSection<ControlsConfig>();

                VirtualPathManager.AddVirtualFileResolver<DummyVirtualFileResolver>(LayoutResolverTests.testVp, "DummyVirtualFileResolver");

                //Act
                try
                {
                    var resolvedVirtualPath = resolver.GetVirtualPath(dummyPageTemplate);

                    //Assert
                    Assert.IsNull(resolvedVirtualPath, "Resolved VirtualPath should be null.");
                }
                finally
                {
                    VirtualPathManager.RemoveVirtualFileResolver(LayoutResolverTests.testVp);
                }
            }
        }