コード例 #1
0
        public Task SubscribeOneConsumer_Complete_StreamIsCompleted()
        {
            return(TryTest(async() =>
            {
                // arrange
                var eventDescription = new EventDescription(
                    Guid.NewGuid().ToString());

                // act
                IEventStream consumer = await _registry
                                        .SubscribeAsync(eventDescription);
                await consumer.CompleteAsync();

                // assert
                Assert.True(consumer.IsCompleted);
            }));
        }
コード例 #2
0
        public Task SubscribeOneConsumer_Complete_StreamIsCompleted()
        {
            return(TestHelper.TryTest(async() =>
            {
                // arrange
                var cts = new CancellationTokenSource(30000);
                var eventDescription = new EventDescription(
                    Guid.NewGuid().ToString());

                // act
                IEventStream consumer = await _registry.SubscribeAsync(eventDescription);
                IAsyncEnumerator <IEventMessage> enumerator = consumer.GetAsyncEnumerator(cts.Token);
                await consumer.CompleteAsync();

                // assert
                Assert.False(await enumerator.MoveNextAsync());
            }));
        }