Esempio n. 1
0
 static async Task ConcatAsync()
 {
     await
     AsyncObservable.Concat(
         AsyncObservable.Range(0, 5),
         AsyncObservable.Range(5, 5),
         AsyncObservable.Range(10, 5),
         AsyncObservable.Range(15, 5)
         )
     .SubscribeAsync(Print <int>());    // TODO: Use ForEachAsync.
 }
Esempio n. 2
0
        public async Task Params0()
        {
            string result = "";

            await AsyncObservable
            .Concat(new IAsyncObservable <int>[] { })
            .Finally(() => result       += "F")
            .SubscribeAsync(i => result += i, ex => result += "E", () => result += "C");

            result
            .Should().Be("CF");
        }
Esempio n. 3
0
        public async Task Params1()
        {
            string result = "";

            var obs1 = AsyncObservable.Range(0, 3).Finally(() => result += ",");

            await AsyncObservable
            .Concat(obs1)
            .Finally(() => result       += "F")
            .SubscribeAsync(i => result += i, ex => result += "E", () => result += "C");

            result
            .Should().Be("012,CF");
        }
Esempio n. 4
0
        public void ArgumentExceptions()
        {
            var obs1 = default(IAsyncObservable <IAsyncObservable <int> >);
            var obs2 = default(IAsyncObservable <int>[]);
            var obs3 = default(IEnumerable <IAsyncObservable <int> >);

            obs1.Invoking(o => o.Concat())
            .Should().Throw <ArgumentNullException>();

            obs2.Invoking(o => AsyncObservable.Concat(o))
            .Should().Throw <ArgumentNullException>();

            obs3.Invoking(o => o.Concat())
            .Should().Throw <ArgumentNullException>();
        }
Esempio n. 5
0
        public async Task Params3Null2()
        {
            string result = "";

            var obs1 = AsyncObservable.Range(0, 3).Finally(() => result += ",");
            var obs2 = default(IAsyncObservable <int>);
            var obs3 = default(IAsyncObservable <int>);

            await AsyncObservable
            .Concat(obs1, obs2, obs3)
            .Finally(() => result       += "F")
            .SubscribeAsync(i => result += i, ex => result += "E", () => result += "C");

            result
            .Should().Be("012,EF");
        }
Esempio n. 6
0
        public async Task Params3Error2()
        {
            string result = "";

            var obs1 = AsyncObservable.Range(0, 3).Finally(() => result += ",");
            var obs2 = AsyncObservable.Throw <int>(new Exception());
            var obs3 = AsyncObservable.Throw <int>(new Exception());

            await AsyncObservable
            .Concat(obs1, obs2, obs3)
            .Finally(() => result       += "F")
            .SubscribeAsync(i => result += i, ex => result += "E", () => result += "C");

            result
            .Should().Be("012,EF");
        }