Esempio n. 1
0
 public async Task TearDown()
 {
     clientPool.Dispose();
     serverPool.Dispose();
     cts.Cancel();
     await serverTask;
 }
Esempio n. 2
0
        public async Task Send_MultipleMediators_DoesNotThrow()
        {
            clientPool.Dispose();
            serverPool.Dispose();
            cts.Cancel();
            cts.Dispose();
            await serverTask;

            cts        = new CancellationTokenSource();
            clientPool = new MediatorClientPool("testpool", poolSize);
            serverPool = new MediatorServerPool(Sender.Object, "testpool", poolSize);
            serverTask = Task.Run(serverPool.Run, cts.Token);

            await clientPool.Send(new VoidRequest());

            serverPool.Dispose();
            clientPool.Dispose();
            cts.Cancel();
            cts.Dispose();
            await serverTask;

            cts        = new CancellationTokenSource();
            clientPool = new MediatorClientPool("testpool", poolSize);
            serverPool = new MediatorServerPool(Sender.Object, "testpool", poolSize);
            serverTask = Task.Run(serverPool.Run, cts.Token);
            AsyncTestDelegate task = () => clientPool.Send(new VoidRequest());

            Assert.DoesNotThrowAsync(task);
        }