Exemple #1
0
 private async Task <IpcEndpointInfo> AcceptAsync(EndpointInfoAccepter accepter)
 {
     using (var cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(3)))
     {
         return(await accepter.AcceptAsync(cancellationSource.Token));
     }
 }
Exemple #2
0
        /// <summary>
        /// Checks that the accepter does not provide a new endpoint info.
        /// </summary>
        private async Task VerifyNoNewEndpointInfos(EndpointInfoAccepter accepter)
        {
            _outputHelper.WriteLine("Verifying there are no more connections.");

            using var cancellationSource = new CancellationTokenSource(TimeSpan.FromSeconds(1));

            Task acceptTask = accepter.AcceptAsync(cancellationSource.Token);
            await Assert.ThrowsAsync <OperationCanceledException>(() => acceptTask);

            Assert.True(acceptTask.IsCanceled);

            _outputHelper.WriteLine("Verified there are no more connections.");
        }