示例#1
0
        public async Task ClientConnectionThrowsConnecting()
        {
            var ex             = new Exception();
            var task           = FromException <IClientConnection>(ex);
            var connectionData = await ServerDispatcher.HandleClientConnection(task).ConfigureAwait(true);

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

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

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

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

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