コード例 #1
0
        public void PooledObjectReturnerDisposeTest()
        {
            var poolMock       = new ObjectPoolMock();
            var pooledObject   = new object();
            var objectReturner = new PooledObjectReturner <object>(poolMock, pooledObject);

            objectReturner.Dispose();

            Assert.AreSame(pooledObject, poolMock._objects.Single());
        }
コード例 #2
0
        public void ObjectPoolGetExtensionTest()
        {
            var poolMock     = new ObjectPoolMock();
            var pooledObject = new object();

            poolMock._objects.Add(pooledObject);
            var objectReturner = poolMock.Get(out var rentedObject);

            objectReturner.Dispose();

            Assert.AreSame(pooledObject, rentedObject);
            Assert.AreSame(pooledObject, poolMock._objects.Single());
        }