Exemple #1
0
    public void CanHandle_TerminateMessage_True()
    {
        // arrange
        var interceptor = new SocketSessionInterceptorMock();
        var handler     = new TerminateConnectionMessageHandler(interceptor);
        var message     = new TerminateConnectionMessage();

        // act
        var result = handler.CanHandle(message);

        // assert
        Assert.True(result);
    }
Exemple #2
0
    public async Task Handle_TerminateMessage_ConnectionClosed()
    {
        // arrange
        var connection = new SocketConnectionMock {
            Closed = false
        };
        var interceptor = new SocketSessionInterceptorMock();
        var handler     = new TerminateConnectionMessageHandler(interceptor);
        var message     = new TerminateConnectionMessage();

        // act
        await handler.HandleAsync(
            connection,
            message,
            CancellationToken.None);

        // assert
        Assert.True(connection.Closed);
    }