コード例 #1
0
        public async Task ShouldCompleteWhenCanceled()
        {
            var mock = new MockConsumer <K, V>();

            var(control, probe) = CreateCommitableSource(mock)
                                  .ToMaterialized(this.SinkProbe <CommittableMessage <K, V> >(), Keep.Both)
                                  .Run(Sys.Materializer());

            probe.Request(100);
            mock.VerifyNotClosed();
            probe.Cancel();
            await control.IsShutdown.WithTimeout(RemainingOrDefault);

            mock.VerifyClosed();
        }
コード例 #2
0
        public async Task ShouldCompleteWhenStopped()
        {
            var mock = new MockConsumer <K, V>();

            var(control, probe) = CreateCommitableSource(mock)
                                  .ToMaterialized(this.SinkProbe <CommittableMessage <K, V> >(), Keep.Both)
                                  .Run(Sys.Materializer());

            probe.Request(100);

            await control.Shutdown().WithTimeout(TimeSpan.FromSeconds(10));

            probe.ExpectComplete();
            mock.VerifyClosed();
        }