Ejemplo n.º 1
0
        public async Task TestWaitToWriteAsync()
        {
            var provider = services.BuildServiceProvider();
            var target   = new ThreadNameExtractingTestTarget();
            var channel  = new DirectChannel(provider.GetService <IApplicationContext>());

            channel.Subscribe(target);
            Assert.True(await channel.Writer.WaitToWriteAsync());
            channel.Unsubscribe(target);
            Assert.False(await channel.Writer.WaitToWriteAsync());
        }
Ejemplo n.º 2
0
        public async Task TestWaitToWriteAsync()
        {
            var services = new ServiceCollection();

            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            var provider = services.BuildServiceProvider();
            var target   = new ThreadNameExtractingTestTarget();
            var channel  = new DirectChannel(provider);

            channel.Subscribe(target);
            Assert.True(await channel.Writer.WaitToWriteAsync());
            channel.Unsubscribe(target);
            Assert.False(await channel.Writer.WaitToWriteAsync());
        }