public void ShouldLoadFilesEvenIfDynamicAssemblyExists() { CompilerHelper.CleanUpDirectory(@".\CompileOutput\"); CompilerHelper.CleanUpDirectory(@".\IgnoreDynamicGeneratedFilesTestDir\"); CompilerHelper.CompileFile(@"Microsoft.Practices.Prism.Tests.Mocks.Modules.MockAttributedModule.cs", @".\IgnoreDynamicGeneratedFilesTestDir\MockAttributedModule.dll"); string path = @".\IgnoreDynamicGeneratedFilesTestDir"; AppDomain testDomain = null; try { testDomain = CreateAppDomain(); RemoteDirectoryLookupCatalog remoteEnum = CreateRemoteDirectoryModuleCatalogInAppDomain(testDomain); remoteEnum.LoadDynamicEmittedModule(); ModuleInfo[] infos = remoteEnum.DoEnumeration(path); Assert.IsNotNull( infos.FirstOrDefault(x => x.ModuleType.IndexOf("Microsoft.Practices.Prism.Tests.Mocks.Modules.MockAttributedModule") >= 0) ); } finally { if (testDomain != null) { AppDomain.Unload(testDomain); } } }
public void ShouldNotThrowWithLoadFromByteAssemblies() { CompilerHelper.CleanUpDirectory(@".\CompileOutput\"); CompilerHelper.CleanUpDirectory(@".\IgnoreLoadFromByteAssembliesTestDir\"); var results = CompilerHelper.CompileFile(@"Prism.WinForms.Tests.Mocks.Modules.MockModuleA.cs", @".\CompileOutput\MockModuleA.dll"); CompilerHelper.CompileFile(@"Prism.WinForms.Tests.Mocks.Modules.MockAttributedModule.cs", @".\IgnoreLoadFromByteAssembliesTestDir\MockAttributedModule.dll"); string path = @".\IgnoreLoadFromByteAssembliesTestDir"; AppDomain testDomain = null; try { testDomain = CreateAppDomain(); RemoteDirectoryLookupCatalog remoteEnum = CreateRemoteDirectoryModuleCatalogInAppDomain(testDomain); remoteEnum.LoadDynamicEmittedModule(); remoteEnum.LoadAssembliesByByte(@".\CompileOutput\MockModuleA.dll"); ModuleInfo[] infos = remoteEnum.DoEnumeration(path); Assert.IsNotNull( infos.FirstOrDefault(x => x.ModuleType.IndexOf("Prism.WinForms.Tests.Mocks.Modules.MockAttributedModule") >= 0) ); } finally { if (testDomain != null) { AppDomain.Unload(testDomain); } } }