public void Dispose_can_be_called_more_than_once() { var mockPool = new Mock <IServerSessionPool>(); var mockWrapped = new Mock <IServerSession>(); var subject = new ServerSessionPool.ReleaseOnDisposeServerSession(mockWrapped.Object, mockPool.Object); subject.Dispose(); subject.Dispose(); mockPool.Verify(m => m.ReleaseSession(mockWrapped.Object), Times.Once); mockWrapped.Verify(m => m.Dispose(), Times.Never); }
public void Dispose_should_set_disposed_flag() { var pool = new Mock <IServerSessionPool>().Object; var mockWrapped = new Mock <IServerSession>(); var subject = new ServerSessionPool.ReleaseOnDisposeServerSession(mockWrapped.Object, pool); subject.Dispose(); subject._disposed().Should().BeTrue(); }