Esempio n. 1
0
        public async Task ClientConnectionThrowsConnecting()
        {
            var ex             = new Exception();
            var task           = FromException <IClientConnection>(ex);
            var connectionData = await ServerDispatcher.HandleClientConnectionAsync(task).ConfigureAwait(true);

            Assert.Equal(CompletionReason.CompilationNotStarted, connectionData.CompletionReason);
            Assert.Null(connectionData.KeepAlive);
        }
Esempio n. 2
0
        public async Task ClientConnectionThrowsHandlingBuild()
        {
            var ex = new Exception();
            var clientConnection = new Mock <IClientConnection>();

            clientConnection
            .Setup(x => x.HandleConnectionAsync(It.IsAny <bool>(), It.IsAny <CancellationToken>()))
            .Returns(FromException <ConnectionData>(ex));

            var task = Task.FromResult(clientConnection.Object);

            var connectionData = await ServerDispatcher.HandleClientConnectionAsync(task).ConfigureAwait(true);

            Assert.Equal(CompletionReason.ClientException, connectionData.CompletionReason);
            Assert.Null(connectionData.KeepAlive);
        }