Example #1
0
        public void GetContainerReturnsRootContainerIfNoModulesFoundWithGivenVirtualPath()
        {
            TestableRootCompositionContainer rootContainer = new TestableRootCompositionContainer();

            rootContainer.Containers.AddNew <CompositionContainer>("Module1");
            MockEnumeratorService enumerator = rootContainer.Services.AddNew <MockEnumeratorService, IModuleEnumerator>();

            enumerator.ModuleInfos = new ModuleInfo[] { new ModuleInfo("Module1", "Module1.Assembly", "~/Module1") };
            ModuleContainerLocatorService service = rootContainer.Services.AddNew <ModuleContainerLocatorService>();

            CompositionContainer result = service.GetContainer("~/Page.aspx");

            Assert.AreSame(rootContainer, result);
        }
Example #2
0
        public void GetContainerReturnsShellContainerEvenIfThereAreTwoFoundationalModules()
        {
            TestableRootCompositionContainer rootContainer  = new TestableRootCompositionContainer();
            CompositionContainer             shellContainer = rootContainer.Containers.AddNew <CompositionContainer>("Shell");
            MockEnumeratorService            enumerator     = rootContainer.Services.AddNew <MockEnumeratorService, IModuleEnumerator>();

            enumerator.ModuleInfos = new ModuleInfo[]
            {
                new ModuleInfo("Shell", "Shell.Assembly", "~/"),
                new ModuleInfo("Module1", "Module1.Assembly", null),
                new ModuleInfo("Module2", "Module2.Assembly", string.Empty)
            };
            ModuleContainerLocatorService service = rootContainer.Services.AddNew <ModuleContainerLocatorService>();

            CompositionContainer result = service.GetContainer("~/Page.aspx");

            Assert.AreSame(shellContainer, result);
        }
Example #3
0
        public void GetContainerReturnsRootContainerEvenIfThereIsAFoundationalModule()
        {
            TestableRootCompositionContainer rootContainer = new TestableRootCompositionContainer();

            rootContainer.Containers.AddNew <CompositionContainer>("Module1");
            MockEnumeratorService enumerator = rootContainer.Services.AddNew <MockEnumeratorService, IModuleEnumerator>();

            enumerator.ModuleInfos = new ModuleInfo[]
            {
                new ModuleInfo("FoundationalModule1", "FoundationalModule1.Assembly", String.Empty),
                new ModuleInfo("Module1", "Module1.Assembly", "~/Module1")
            };
            ModuleContainerLocatorService service = rootContainer.Services.AddNew <ModuleContainerLocatorService>();

            CompositionContainer result = service.GetContainer("~/Page.aspx");

            Assert.AreSame(rootContainer, result);
        }
Example #4
0
        public void GetContainerReturnsContainerOfModuleInSubFolderWithDifferentCase()
        {
            TestableRootCompositionContainer rootContainer    = new TestableRootCompositionContainer();
            CompositionContainer             module1Container = rootContainer.Containers.AddNew <CompositionContainer>("Module1");

            rootContainer.Containers.AddNew <CompositionContainer>("Shell");
            MockEnumeratorService enumerator = rootContainer.Services.AddNew <MockEnumeratorService, IModuleEnumerator>();

            enumerator.ModuleInfos = new ModuleInfo[]
            {
                new ModuleInfo("Shell", "Shell.Assembly", "~/"),
                new ModuleInfo("Module1", "Module1.Assembly", "~/module1")
            };
            ModuleContainerLocatorService service = rootContainer.Services.AddNew <ModuleContainerLocatorService>();

            CompositionContainer result = service.GetContainer("~/Module1/Page.aspx");

            Assert.AreSame(module1Container, result);
        }