コード例 #1
0
 public void FileModuleTypeLoaderDisposeDoesNotThrowWithNonDisposableAssemblyResolver()
 {
     Mock<IAssemblyResolver> mockResolver = new Mock<IAssemblyResolver>();
     var typeLoader = new FileModuleTypeLoader(mockResolver.Object);
     try
     {
         typeLoader.Dispose();
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }
コード例 #2
0
        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());
        }