Reset() public method

public Reset ( ) : void
return void
Example #1
0
        public void ClientSuddenlyDisconnectsAfterConnect([Values(true, false)]bool shouldReset, [Values(true, false)]bool connectionClose, [Values(true, false)]bool connectionReset)
        {
            Session session = new Session( _mockDispatcher.Object, _mockFilter.Object);

            session.Start(_mockClient.Object);

            if (connectionReset)
                _mockClient.Raise(m => m.Shutdown += null, new EventArgs());

            if (connectionClose)
                _mockClient.Raise(m => m.ConnectionClosed += null, new EventArgs());

            // This should not cause an exception regardless
            if(shouldReset)
                session.Reset();

            if (connectionClose || shouldReset || connectionReset)
            {
                _mockDispatcher.Verify(m => m.Reset(), Times.Once());
                _mockClient.Verify(m => m.Close(), Times.Once());
            }
            else
            {
                _mockDispatcher.Verify(m => m.Reset(), Times.Never());
                _mockClient.Verify(m => m.Close(), Times.Never());
            }
        }
Example #2
0
        public void ResetWithoutConnectTest()
        {
            Session session = new Session( _mockDispatcher.Object, _mockFilter.Object);

            session.Reset();
        }