コード例 #1
0
        public void Enumerable_Limit_Max_Concurrency()
        {
            var ms1 = new MaybeSubject <int>();
            var ms2 = new MaybeSubject <int>();

            var to = MaybeSource.ConcatEager(
                new List <IMaybeSource <int> >()
            {
                ms1, ms2
            }
                , maxConcurrency: 1
                )
                     .Test();

            Assert.True(ms1.HasObserver());
            Assert.False(ms2.HasObserver());

            ms1.OnSuccess(1);

            Assert.False(ms1.HasObserver());
            Assert.True(ms2.HasObserver());

            ms2.OnSuccess(2);

            to.AssertResult(1, 2);
        }
コード例 #2
0
 public void Enumerable_Limit_GetEnumerator_Crash()
 {
     for (int i = 1; i < 10; i++)
     {
         MaybeSource.ConcatEager(new FailingEnumerable <IMaybeSource <int> >(true, false, false), maxConcurrency: i)
         .Test()
         .AssertFailure(typeof(InvalidOperationException));
     }
 }
コード例 #3
0
 public void Enumerable_Limit_MoveNext_Crash_DelayErrors()
 {
     for (int i = 1; i < 10; i++)
     {
         MaybeSource.ConcatEager(new FailingEnumerable <IMaybeSource <int> >(false, true, false), true, i)
         .Test()
         .AssertFailure(typeof(InvalidOperationException));
     }
 }
コード例 #4
0
 public void Enumerable_Limit_Empty()
 {
     for (int i = 1; i < 10; i++)
     {
         MaybeSource.ConcatEager <int>(maxConcurrency: i)
         .Test()
         .WithTag($"{i}")
         .AssertResult();
     }
 }
コード例 #5
0
 public void Array_Max_Basic_All_Empty()
 {
     MaybeSource.ConcatEager(
         MaybeSource.Empty <int>(),
         MaybeSource.Empty <int>(),
         MaybeSource.Empty <int>(),
         MaybeSource.Empty <int>()
         )
     .Test()
     .AssertResult();
 }
コード例 #6
0
 public void Max_Basic_All_Empty()
 {
     MaybeSource.ConcatEager(
         new [] {
         MaybeSource.Empty <int>(),
         MaybeSource.Empty <int>(),
         MaybeSource.Empty <int>(),
         MaybeSource.Empty <int>()
     }.ToObservable()
         )
     .Test()
     .AssertResult();
 }
コード例 #7
0
 public void Enumerable_Max_Basic_All_Empty()
 {
     MaybeSource.ConcatEager(
         new List <IMaybeSource <int> >()
     {
         MaybeSource.Empty <int>(),
         MaybeSource.Empty <int>(),
         MaybeSource.Empty <int>(),
         MaybeSource.Empty <int>()
     }
         )
     .Test()
     .AssertResult();
 }
コード例 #8
0
 public void Array_Limit_Basic_Delay()
 {
     for (int i = 1; i < 10; i++)
     {
         MaybeSource.ConcatEager <int>(true, i,
                                       MaybeSource.Just(1),
                                       MaybeSource.Just(2),
                                       MaybeSource.Empty <int>(),
                                       MaybeSource.Just(3)
                                       )
         .Test()
         .WithTag($"{i}")
         .AssertResult(1, 2, 3);
     }
 }
コード例 #9
0
        public void Array_Max_Dispose()
        {
            var ms1 = new MaybeSubject <int>();
            var ms2 = new MaybeSubject <int>();

            var to = MaybeSource.ConcatEager(ms1, ms2)
                     .Test();

            Assert.True(ms1.HasObserver());
            Assert.True(ms2.HasObserver());

            to.Dispose();

            Assert.False(ms1.HasObserver());
            Assert.False(ms2.HasObserver());
        }
コード例 #10
0
        public void Array_Max_Error_Delay()
        {
            var count = 0;

            var src = MaybeSource.FromFunc(() => ++ count);

            MaybeSource.ConcatEager(true,
                                    MaybeSource.Just(0),
                                    MaybeSource.Error <int>(new InvalidOperationException()),
                                    src
                                    )
            .Test()
            .AssertFailure(typeof(InvalidOperationException), 0, 1);

            Assert.AreEqual(1, count);
        }
コード例 #11
0
 public void Limit_Basic_Delay()
 {
     for (int i = 1; i < 10; i++)
     {
         MaybeSource.ConcatEager <int>(
             new [] {
             MaybeSource.Just(1),
             MaybeSource.Just(2),
             MaybeSource.Empty <int>(),
             MaybeSource.Just(3)
         }.ToObservable()
             , true, i)
         .Test()
         .WithTag($"{i}")
         .AssertResult(1, 2, 3);
     }
 }
コード例 #12
0
 public void Enumerable_Limit_Basic_Delay()
 {
     for (int i = 1; i < 10; i++)
     {
         MaybeSource.ConcatEager <int>(
             new List <IMaybeSource <int> >()
         {
             MaybeSource.Just(1),
             MaybeSource.Just(2),
             MaybeSource.Empty <int>(),
             MaybeSource.Just(3)
         }
             , true, i)
         .Test()
         .WithTag($"{i}")
         .AssertResult(1, 2, 3);
     }
 }
コード例 #13
0
        public void Array_Max_Error_Dispose_Second()
        {
            var ms1 = new MaybeSubject <int>();
            var ms2 = new MaybeSubject <int>();

            var to = MaybeSource.ConcatEager(ms1, ms2)
                     .Test();

            Assert.True(ms1.HasObserver());
            Assert.True(ms2.HasObserver());

            ms2.OnError(new InvalidOperationException());

            Assert.False(ms1.HasObserver());
            Assert.False(ms2.HasObserver());

            to.AssertFailure(typeof(InvalidOperationException));
        }
コード例 #14
0
        public void Enumerable_Max_Dispose()
        {
            var ms1 = new MaybeSubject <int>();
            var ms2 = new MaybeSubject <int>();

            var to = MaybeSource.ConcatEager(
                new List <IMaybeSource <int> >()
            {
                ms1, ms2
            })
                     .Test();

            Assert.True(ms1.HasObserver());
            Assert.True(ms2.HasObserver());

            to.Dispose();

            Assert.False(ms1.HasObserver());
            Assert.False(ms2.HasObserver());
        }
コード例 #15
0
        public void Array_Limit_Keep_Order()
        {
            var ms1 = new MaybeSubject <int>();
            var ms2 = new MaybeSubject <int>();

            var to = MaybeSource.ConcatEager(2,
                                             ms1, ms2
                                             )
                     .Test();

            Assert.True(ms1.HasObserver());
            Assert.True(ms2.HasObserver());

            ms2.OnSuccess(2);

            to.AssertEmpty();

            ms1.OnSuccess(1);

            to.AssertResult(1, 2);
        }
コード例 #16
0
        public void Limit_Error_Delay()
        {
            for (int i = 1; i < 10; i++)
            {
                var count = 0;

                var src = MaybeSource.FromFunc(() => ++ count);

                MaybeSource.ConcatEager(
                    new [] {
                    MaybeSource.Just(0),
                    MaybeSource.Error <int>(new InvalidOperationException()),
                    src
                }.ToObservable(), true, i
                    )
                .Test()
                .AssertFailure(typeof(InvalidOperationException), 0, 1);

                Assert.AreEqual(1, count);
            }
        }
コード例 #17
0
        public void Array_Limit_Max_Concurrency()
        {
            var ms1 = new MaybeSubject <int>();
            var ms2 = new MaybeSubject <int>();

            var to = MaybeSource.ConcatEager(1,
                                             ms1, ms2
                                             )
                     .Test();

            Assert.True(ms1.HasObserver());
            Assert.False(ms2.HasObserver());

            ms1.OnSuccess(1);

            Assert.False(ms1.HasObserver());
            Assert.True(ms2.HasObserver());

            ms2.OnSuccess(2);

            to.AssertResult(1, 2);
        }
コード例 #18
0
        public void Limit_Keep_Order()
        {
            var ms1 = new MaybeSubject <int>();
            var ms2 = new MaybeSubject <int>();

            var to = MaybeSource.ConcatEager(
                new [] {
                ms1, ms2
            }.ToObservable(), maxConcurrency: 2
                )
                     .Test();

            Assert.True(ms1.HasObserver());
            Assert.True(ms2.HasObserver());

            ms2.OnSuccess(2);

            to.AssertEmpty();

            ms1.OnSuccess(1);

            to.AssertResult(1, 2);
        }
コード例 #19
0
        public void Enumerable_Max_Error_Dispose_First()
        {
            var ms1 = new MaybeSubject <int>();
            var ms2 = new MaybeSubject <int>();

            var to = MaybeSource.ConcatEager(
                new List <IMaybeSource <int> >()
            {
                ms1, ms2
            }
                )
                     .Test();

            Assert.True(ms1.HasObserver());
            Assert.True(ms2.HasObserver());

            ms1.OnError(new InvalidOperationException());

            Assert.False(ms1.HasObserver());
            Assert.False(ms2.HasObserver());

            to.AssertFailure(typeof(InvalidOperationException));
        }
コード例 #20
0
        public void Enumerable_Max_Keep_Order()
        {
            var ms1 = new MaybeSubject <int>();
            var ms2 = new MaybeSubject <int>();

            var to = MaybeSource.ConcatEager(
                new List <IMaybeSource <int> >()
            {
                ms1, ms2
            }
                )
                     .Test();

            Assert.True(ms1.HasObserver());
            Assert.True(ms2.HasObserver());

            ms2.OnSuccess(2);

            to.AssertEmpty();

            ms1.OnSuccess(1);

            to.AssertResult(1, 2);
        }
コード例 #21
0
 public void Enumerable_Max_MoveNext_Crash()
 {
     MaybeSource.ConcatEager(new FailingEnumerable <IMaybeSource <int> >(false, true, false))
     .Test()
     .AssertFailure(typeof(InvalidOperationException));
 }
コード例 #22
0
 public void Enumerable_Max_GetEnumerator_Crash_DelayErrors()
 {
     MaybeSource.ConcatEager(new FailingEnumerable <IMaybeSource <int> >(true, false, false), true)
     .Test()
     .AssertFailure(typeof(InvalidOperationException));
 }