public async Task TestAllButOneEmptyEnums()
        {
            var enum1 = new IntegerEnumerableAsync(new List <int>()
            {
                1, 2, 3, 4, 5
            });
            var enum2 = new IntegerEnumerableAsync(new List <int>()
            {
            });
            var enum3 = new IntegerEnumerableAsync(new List <int>()
            {
            });

            var aggregateEnumerable = new AggregateEnumerableAsync <int>(new List <IEnumerableAsync <int> > {
                enum1, enum2, enum3
            }, null, null);
            var enumerator = aggregateEnumerable.GetEnumeratorAsync();

            var expectedUniqueCount = 5;
            var actualCount         = 0;
            var last = int.MinValue;

            while (await enumerator.MoveNextAsync())
            {
                actualCount++;
                var current = enumerator.Current;
                Assert.True(last < current, "Incorrent order: " + last + " should be before " + current);
                last = current;
            }

            Assert.Equal(expectedUniqueCount, actualCount);
        }
        public async Task TestMultipleOverlappingEnums()
        {
            var enum1 = new IntegerEnumerableAsync(new List <int>()
            {
                1, 4, 5, 8, 9
            });
            var enum2 = new IntegerEnumerableAsync(new List <int>()
            {
                2, 3, 6, 7, 10
            });
            var enum3 = new IntegerEnumerableAsync(new List <int>()
            {
                3, 5, 7, 12, 15
            });


            var aggregateEnumerable = new AggregateEnumerableAsync <int>(new List <IEnumerableAsync <int> > {
                enum1, enum2, enum3
            }, null, null);
            var enumerator = aggregateEnumerable.GetEnumeratorAsync();

            var expectedUniqueCount = 12;
            var actualCount         = 0;
            var last = int.MinValue;

            while (await enumerator.MoveNextAsync())
            {
                actualCount++;
                var current = enumerator.Current;
                Assert.True(last < current, "Incorrent order: " + last + " should be before " + current);
                last = current;
            }

            Assert.Equal(expectedUniqueCount, actualCount);
            // Assert that whole sorting process is commutative
            aggregateEnumerable = new AggregateEnumerableAsync <int>(new List <IEnumerableAsync <int> > {
                enum3, enum2, enum1
            }, null, null);
            enumerator = aggregateEnumerable.GetEnumeratorAsync();

            expectedUniqueCount = 12;
            actualCount         = 0;
            last = int.MinValue;
            while (await enumerator.MoveNextAsync())
            {
                actualCount++;
                var current = enumerator.Current;
                Assert.True(last <= current, "Incorrent order: " + last + " should be before " + current);
                last = current;
            }

            Assert.Equal(expectedUniqueCount, actualCount);
        }
        public async Task TestAllEmptyEnums()
        {
            var enum1 = new IntegerEnumerableAsync(new List <int>()
            {
            });
            var enum2 = new IntegerEnumerableAsync(new List <int>()
            {
            });
            var enum3 = new IntegerEnumerableAsync(new List <int>()
            {
            });

            HashSet <int> blaa = new HashSet <int>();

            var aggregateEnumerable = new AggregateEnumerableAsync <int>(new List <IEnumerableAsync <int> > {
                enum1, enum2, enum3
            }, null, null);
            var enumerator = aggregateEnumerable.GetEnumeratorAsync();

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