Exemplo n.º 1
0
        public virtual void Return_Already_Disposed()
        {
            // Arrange
            MockInnerPool.Setup(inner => inner.Dispose());
            MockManagedPool.Setup(managed => managed.Clear()).Returns(true);
            DecoratedPool.Dispose();

            // Act
            var result = DecoratedPool.Return(null);

            // Assert
            Assert.False(result);
        }
Exemplo n.º 2
0
        public override void Return_Already_Disposed()
        {
            // Arrange
            MockInnerPool.Setup(inner => inner.Take(null)).Returns((string)null);
            MockInnerPool.Setup(inner => inner.Count).Returns(0);
            MockInnerPool.Setup(inner => inner.Dispose());
            DecoratedPool.Dispose();

            // Act
            var result = DecoratedPool.Return(null);

            // Assert
            Assert.False(result);
        }
Exemplo n.º 3
0
        public override void Return_Already_Disposed()
        {
            // Arrange
            var items = new Queue <string>(new string[] { "x", "x", null });

            MockInnerPool.Setup(inner => inner.Take(null)).Returns(items.Dequeue);
            MockInnerPool.Setup(inner => inner.Count).Returns(0);
            MockInnerPool.Setup(inner => inner.Dispose());
            DecoratedPool.Dispose();

            // Act
            var result = DecoratedPool.Return(null);

            // Assert
            Assert.False(result);
        }