示例#1
0
        private async Task ValidateTwoLevelAggregateSetupAndTearDown()
        {
            int numberOfStreamsPerLevel = 2;


            var source = new MultiStreamProvider <int>(_provider, numberOfStreamsPerLevel);

            var factory      = new DefaultStreamProcessorAggregateFactory(GrainFactory);
            var aggregateOne = await factory.CreateSelect(_ => _, await source.GetStreamIdentities());

            var aggregateTwo = await factory.CreateSelect(_ => _, await aggregateOne.GetStreamIdentities());


            var firstElement = new StreamProcessorChainStart <int, int>(aggregateOne, source, new DefaultStreamProcessorAggregateFactory(GrainFactory));
            var query        = new StreamProcessorChain <int, int>(aggregateTwo, firstElement);

            Assert.IsFalse(await aggregateOne.IsTearedDown());
            Assert.IsFalse(await aggregateTwo.IsTearedDown());

            await query.TearDown();

            Assert.IsTrue(await aggregateOne.IsTearedDown());
            Assert.IsTrue(await aggregateTwo.IsTearedDown());
        }
示例#2
0
        private async Task ValidateTwoLevelAggregateSetupAndTearDown()
        {
            int numberOfStreamsPerLevel = 2;


            var source = new StreamMessageSenderComposite <int>(_provider, numberOfStreamsPerLevel);

            var factory      = new DefaultStreamProcessorAggregateFactory(GrainFactory);
            var aggregateOne = await factory.CreateSelect <int, int>(_ => _, new StreamProcessorAggregateConfiguration(await source.GetOutputStreams()));

            var aggregateTwo = await factory.CreateSelect <int, int>(_ => _, new StreamProcessorAggregateConfiguration(await aggregateOne.GetOutputStreams()));


            var firstElement = new StreamProcessorChainStart <int, int, DefaultStreamProcessorAggregateFactory>(aggregateOne, source, new DefaultStreamProcessorAggregateFactory(GrainFactory));
            var query        = new StreamProcessorChain <int, int, DefaultStreamProcessorAggregateFactory>(aggregateTwo, firstElement);

            Assert.IsFalse(await aggregateOne.IsTearedDown());
            Assert.IsFalse(await aggregateTwo.IsTearedDown());

            await query.TearDown();

            Assert.IsTrue(await aggregateOne.IsTearedDown());
            Assert.IsTrue(await aggregateTwo.IsTearedDown());
        }