public async Task CanOpenWebSocketToIoTHub()
        {
            // Arrange
            var secureShellDevice = new SecureShell(localhost, localPort);

            // Act
            await secureShellDevice.OpenConnectionAsync(this.deviceClientMock.Object, this.clientWebSocket.Object, this.tcpClient.Object, this.cancellationTokenSource);

            // Assert
            this.clientWebSocket.Verify(cws => cws.ConnectAsync(uri, this.cancellationTokenSource.Token), Times.Once);
        }
        public async Task CanAcceptDeviceStreamRequest()
        {
            // Arrange
            var secureShellDevice = new SecureShell(localhost, localPort);

            // Act
            await secureShellDevice.OpenConnectionAsync(this.deviceClientMock.Object, this.clientWebSocket.Object, this.tcpClient.Object, this.cancellationTokenSource);

            // Assert
            this.deviceClientMock.Verify(dc => dc.AcceptDeviceStreamRequestAsync(this.deviceStreamRequest, this.cancellationTokenSource.Token), Times.Once);
        }
        public async Task CanReadFromLocalStreamToWebSocket()
        {
            // Arrange
            var secureShellDevice = new SecureShell(localhost, localPort);

            // Act
            await secureShellDevice.OpenConnectionAsync(this.deviceClientMock.Object, this.clientWebSocket.Object, this.tcpClient.Object, this.cancellationTokenSource);

            // Assert
            this.tcpClient.Verify(tc => tc.GetStream(), Times.Once);
            this.networkStream.Verify(ns => ns.ReadAsync(It.IsAny <byte[]>(), 0, bufferSize, this.cancellationTokenSource.Token), Times.Once);
            this.clientWebSocket.Verify(cws => cws.SendAsync(It.IsAny <ArraySegment <byte> >(), WebSocketMessageType.Binary, true, this.cancellationTokenSource.Token), Times.Once);
        }
        public async Task CanReadFromWebSocketToLocalStream()
        {
            // Arrange
            var secureShellDevice = new SecureShell(localhost, localPort);

            // Act
            await secureShellDevice.OpenConnectionAsync(this.deviceClientMock.Object, this.clientWebSocket.Object, this.tcpClient.Object, this.cancellationTokenSource);

            // Assert
            this.tcpClient.Verify(tc => tc.GetStream(), Times.Once);
            this.clientWebSocket.Verify(cws => cws.ReceiveAsync(this.buffer, this.cancellationTokenSource.Token), Times.Once);
            this.networkStream.Verify(ns => ns.WriteAsync(this.buffer, 0, streamReturnValue, this.cancellationTokenSource.Token), Times.Once);
        }