public void DisposeDoesNotThrowWithMixedTypeLoaders()
        {
            Mock<IModuleInitializer> mockInit = new Mock<IModuleInitializer>();
            var moduleInfo = CreateModuleInfo("needsRetrieval", InitializationMode.WhenAvailable);
            var catalog = new Mock<IModuleCatalog>();
            ModuleManager manager = new ModuleManager(mockInit.Object, catalog.Object, new MockLogger());

            var mockTypeLoader1 = new Mock<IModuleTypeLoader>();

            var mockTypeLoader = new Mock<IModuleTypeLoader>();
            var disposableMockTypeLoader = mockTypeLoader.As<IDisposable>();
            disposableMockTypeLoader.Setup(loader => loader.Dispose());

            manager.ModuleTypeLoaders = new List<IModuleTypeLoader>() { mockTypeLoader1.Object, mockTypeLoader.Object };

            try
            {
                manager.Dispose();
            }
            catch (Exception)
            {
                Assert.Fail();
            }

            disposableMockTypeLoader.Verify(loader => loader.Dispose(), Times.Once());
        }
        public void DisposeCleansUpDisposableTypeLoaders()
        {
            Mock<IModuleInitializer> mockInit = new Mock<IModuleInitializer>();
            var moduleInfo = CreateModuleInfo("needsRetrieval", InitializationMode.WhenAvailable);
            var catalog = new Mock<IModuleCatalog>();
            ModuleManager manager = new ModuleManager(mockInit.Object, catalog.Object, new MockLogger());

            var mockTypeLoader = new Mock<IModuleTypeLoader>();
            var disposableMockTypeLoader = mockTypeLoader.As<IDisposable>();
            disposableMockTypeLoader.Setup(loader => loader.Dispose());

            manager.ModuleTypeLoaders = new List<IModuleTypeLoader> { mockTypeLoader.Object };

            manager.Dispose();

            disposableMockTypeLoader.Verify(loader => loader.Dispose(), Times.Once());
        }
        public void DisposeDoesNotThrowWithNonDisposableTypeLoaders()
        {
            Mock<IModuleInitializer> mockInit = new Mock<IModuleInitializer>();
            var moduleInfo = CreateModuleInfo("needsRetrieval", InitializationMode.WhenAvailable);
            var catalog = new Mock<IModuleCatalog>();
            ModuleManager manager = new ModuleManager(mockInit.Object, catalog.Object, new MockLogger());

            var mockTypeLoader = new Mock<IModuleTypeLoader>();
            manager.ModuleTypeLoaders = new List<IModuleTypeLoader> {mockTypeLoader.Object};

            try
            {
                manager.Dispose();
            }
            catch(Exception)
            {
                Assert.Fail();
            }
        }