public void DoubleReturnError() { var mock = new Mock <IArrayPool>(); using (var memoryStream = new PooledMemoryStream(mock.Object, 128)) { mock.Verify(s => s.Return(It.IsAny <byte[]>()), Times.Never); memoryStream.Close(); mock.Verify(s => s.Return(It.IsAny <byte[]>()), Times.Once); } mock.Verify(s => s.Return(It.IsAny <byte[]>()), Times.Once); }