public void FileModuleTypeLoaderDisposeDoesNotThrowWithNonDisposableAssemblyResolver() { Mock<IAssemblyResolver> mockResolver = new Mock<IAssemblyResolver>(); var typeLoader = new FileModuleTypeLoader(mockResolver.Object); try { typeLoader.Dispose(); } catch (Exception) { Assert.Fail(); } }
public void FileModuleTypeLoaderDisposeNukesAssemblyResolver() { Mock<IAssemblyResolver> mockResolver = new Mock<IAssemblyResolver>(); var disposableMockResolver = mockResolver.As<IDisposable>(); disposableMockResolver.Setup(resolver => resolver.Dispose()); var typeLoader = new FileModuleTypeLoader(mockResolver.Object); typeLoader.Dispose(); disposableMockResolver.Verify(resolver => resolver.Dispose(), Times.Once()); }