Exemplo n.º 1
0
 public async void AssertResultSet_List()
 {
     await AsyncEnum.FromArray(new List <int>(new [] { 1, 2, 3 }))
     .AssertResultSet(
         ListComparer <int> .Default,
         new List <int>(new[] { 1, 2, 3 }));
 }
Exemplo n.º 2
0
 public async void Async_Normal()
 {
     await
     AsyncEnum.FromArray(
         AsyncEnumerable.Range(1, 3),
         AsyncEnumerable.Empty <int>(),
         AsyncEnum.FromArray(4, 5, 6, 7),
         AsyncEnumerable.Empty <int>(),
         AsyncEnum.Just(8),
         AsyncEnum.FromEnumerable(new[] { 9, 10 }),
         AsyncEnumerable.Empty <int>()
         )
     .Merge()
     .AssertResultSet(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
 }
Exemplo n.º 3
0
        public async void OutOfOrder()
        {
            var t = 100;

            if (Environment.GetEnvironmentVariable("CI") != null)
            {
                t = 1000;
            }

            var result = AsyncEnum.FromArray(
                t, 3 * t, 2 * t, 0, 5 * t, 4 * t
                )
                         .FlatMap(v => AsyncEnum.Timer(TimeSpan.FromMilliseconds(v)).Select(w => v))
            ;

            await result.AssertResult(0, t, 2 *t, 3 *t, 4 *t, 5 *t);
        }