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); }
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); }
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); }
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); }
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); }