public async Task TestTearDownStreamBroken() { var source = new StreamMessageSenderComposite <int>(_provider, 2); var factory = new DefaultStreamProcessorAggregateFactory(GrainFactory); var query = await source.Select(x => x, factory); var queryOutputStreams = await query.GetOutputStreams(); var resultConsumer = new TestTransactionalTransactionalStreamConsumerAggregate <int>(_provider); await resultConsumer.SetInput(queryOutputStreams); Assert.AreEqual(2, queryOutputStreams.Count); Assert.AreEqual(0, resultConsumer.Items.Count); Assert.IsFalse(await resultConsumer.AllConsumersTearDownCalled()); await query.TearDown(); await resultConsumer.TearDown(); Assert.IsTrue(await resultConsumer.AllConsumersTearDownCalled()); await source.SendMessage(new ItemMessage <int>(new List <int>() { 2, 3 })); Assert.AreEqual(0, resultConsumer.Items.Count); Assert.IsTrue(await resultConsumer.AllConsumersTearDownCalled()); }