public void Dispose_should_dispose_session() { var mockSession = new Mock <ICoreSessionHandle>(); var subject = new ServerChannelSource(_mockServer.Object, mockSession.Object); subject.Dispose(); mockSession.Verify(m => m.Dispose(), Times.Once); }
public void GetChannelAsync_should_throw_if_disposed() { var subject = new ServerChannelSource(_server); subject.Dispose(); Action act = () => subject.GetChannelAsync(CancellationToken.None); act.ShouldThrow <ObjectDisposedException>(); }
public void GetChannel_should_throw_if_disposed( [Values(false, true)] bool async) { var subject = new ServerChannelSource(_mockServer.Object); subject.Dispose(); Action act; if (async) { act = () => subject.GetChannelAsync(CancellationToken.None).GetAwaiter().GetResult(); } else { act = () => subject.GetChannel(CancellationToken.None); } act.ShouldThrow<ObjectDisposedException>(); }
public void GetChannel_should_throw_if_disposed( [Values(false, true)] bool async) { var subject = new ServerChannelSource(_server); subject.Dispose(); Action act; if (async) { act = () => subject.GetChannelAsync(CancellationToken.None).GetAwaiter().GetResult(); } else { act = () => subject.GetChannel(CancellationToken.None); } act.ShouldThrow <ObjectDisposedException>(); }