Exemple #1
0
        public static void Disposing()
        {
            // Arrange
            var mockInnerPool = new Mock <IPool <IDisposable> >(MockBehavior.Strict);
            var decoratedPool = new Mock <ManagedPool <IDisposable> >(mockInnerPool.Object, Disposable.CreateReleaseFactory());

            mockInnerPool.Setup(inner => inner.Name).Returns("Mock");
            mockInnerPool.Setup(inner => inner.Dispose());
            decoratedPool.CallBase = true;
            decoratedPool.Setup(p => p.Clear());

            // Act
            decoratedPool.Object.Dispose();

            // Assert
            mockInnerPool.VerifyAll();
            decoratedPool.VerifyAll();
        }