public void Dispose_with_disposing_should_dispose_wrapped_when_appropriate(bool ownsWrapped, bool disposing, bool shouldDispose) { var mockWrapped = new Mock <ICoreServerSession>(); var subject = new MockWrappingCoreServerSession(mockWrapped.Object, ownsWrapped); subject.Dispose(disposing); mockWrapped.Verify(m => m.Dispose(), Times.Exactly(shouldDispose ? 1 : 0)); }
public void constructor_should_initialize_instance(bool ownsWrapped) { var wrapped = new Mock <ICoreServerSession>().Object; var result = new MockWrappingCoreServerSession(wrapped, ownsWrapped); result.Wrapped.Should().BeSameAs(wrapped); result._disposed().Should().BeFalse(); result._ownsWrapped().Should().Be(ownsWrapped); }