Beispiel #1
0
        public void FanIn_completes_collection_after_loop()
        {
            var sut          = new Pipelines();
            var numbers      = new int[] { 1, 2, 3, 4 };
            var source       = sut.Generate(numbers);
            var sequence1    = sut.Squre(source);
            var sequence2    = sut.Squre(source);
            var mergedSource = sut.FanIn(sequence1, sequence2);

            foreach (var n in mergedSource.GetConsumingEnumerable())
            {
            }
            Assert.True(mergedSource.IsCompleted);
        }
Beispiel #2
0
        public void FanIn()
        {
            var sut       = new Pipelines();
            var numbers   = new int[] { 1, 2, 3, 4 };
            var expected  = new int[] { 1, 4, 9, 16 };
            var source    = sut.Generate(numbers);
            var sequence1 = sut.Squre(source);
            var sequence2 = sut.Squre(source);
            var count     = 0;
            var merged    = sut.FanIn(sequence1, sequence2).GetConsumingEnumerable();

            foreach (var n in merged)
            {
                Assert.Contains(n, expected);
                count++;
            }
            Assert.Equal(4, count);
        }