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()); }
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()); }