Beispiel #1
0
        public void GetContainerReturnsRootContainerIfNoModules()
        {
            TestableRootCompositionContainer rootContainer = new TestableRootCompositionContainer();

            rootContainer.Services.AddNew <MockEnumeratorService, IModuleEnumerator>();
            ModuleContainerLocatorService service = rootContainer.Services.AddNew <ModuleContainerLocatorService>();

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

            Assert.AreSame(rootContainer, result);
            Assert.AreSame(result, result2);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
Beispiel #5
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);
        }