Esempio n. 1
0
 public void Exact_Basic_2()
 {
     ObservableSource.Range(1, 10)
     .Window(2)
     .FlatMap(v => v.ToList())
     .Test()
     .AssertResult(
         new List <int>()
     {
         1, 2
     },
         new List <int>()
     {
         3, 4
     },
         new List <int>()
     {
         5, 6
     },
         new List <int>()
     {
         7, 8
     },
         new List <int>()
     {
         9, 10
     }
         );
 }
Esempio n. 2
0
 public void Handler_Errors()
 {
     ObservableSource.Range(1, 5)
     .RepeatWhen(v => v.Take(1).Skip(1).ConcatError(new NotImplementedException()))
     .Test()
     .AssertFailure(typeof(NotImplementedException), 1, 2, 3, 4, 5);
 }
Esempio n. 3
0
 public void Handler_Crash()
 {
     ObservableSource.Range(1, 5)
     .RetryWhen <int, int>(v => throw new InvalidOperationException())
     .Test()
     .AssertFailure(typeof(InvalidOperationException));
 }
 public void Plain_Reducer_Crash()
 {
     ObservableSource.Range(1, 5)
     .Reduce((a, b) => throw new InvalidOperationException())
     .Test()
     .AssertFailure(typeof(InvalidOperationException));
 }
 public void Basic()
 {
     ObservableSource.Range(1, 5)
     .OnErrorResumeNext(v => ObservableSource.Range(6, 5))
     .Test()
     .AssertResult(1, 2, 3, 4, 5);
 }
Esempio n. 6
0
 public void Until_Empty()
 {
     ObservableSource.Range(1, 5)
     .SkipUntil(ObservableSource.Empty <int>())
     .Test()
     .AssertResult(1, 2, 3, 4, 5);
 }
 public void Default_Basic()
 {
     ObservableSource.Range(1, 5)
     .Last(100)
     .Test()
     .AssertResult(5);
 }
 public void Int_Take_Zero()
 {
     ObservableSource.Range(1, 5)
     .Take(0)
     .Test()
     .AssertResult();
 }
 public void Int_Take_Exact()
 {
     ObservableSource.Range(1, 5)
     .Take(5)
     .Test()
     .AssertResult(1, 2, 3, 4, 5);
 }
Esempio n. 10
0
 public void Include_All()
 {
     ObservableSource.Range(1, 5)
     .TakeUntil(v => false)
     .Test()
     .AssertResult(1, 2, 3, 4, 5);
 }
 public void Int_Take()
 {
     ObservableSource.Range(1, 5)
     .Take(3)
     .Test()
     .AssertResult(1, 2, 3);
 }
Esempio n. 12
0
 public void Exclude_All()
 {
     ObservableSource.Range(1, 5)
     .TakeUntil(v => true)
     .Test()
     .AssertResult(1);
 }
Esempio n. 13
0
 public void Basic()
 {
     ObservableSource.Range(1, 5)
     .TakeUntil(v => v == 3)
     .Test()
     .AssertResult(1, 2, 3);
 }
Esempio n. 14
0
 public void Exact_Basic_3()
 {
     ObservableSource.Range(1, 10)
     .Window(3)
     .FlatMap(v => v.ToList())
     .Test()
     .AssertResult(
         new List <int>()
     {
         1, 2, 3
     },
         new List <int>()
     {
         4, 5, 6
     },
         new List <int>()
     {
         7, 8, 9
     },
         new List <int>()
     {
         10
     }
         );
 }
Esempio n. 15
0
 public void Basic()
 {
     ObservableSource.Range(1, 5)
     .SkipUntil(ObservableSource.Never <int>())
     .Test()
     .AssertResult();
 }
 public void Basic()
 {
     ObservableSource.Range(1, 5)
     .Any(v => v == 3)
     .Test()
     .AssertResult(true);
 }
Esempio n. 17
0
 public void Until_Just()
 {
     ObservableSource.Range(1, 5)
     .SkipUntil(ObservableSource.Just(1))
     .Test()
     .AssertResult(1, 2, 3, 4, 5);
 }
 public void Not_Found()
 {
     ObservableSource.Range(1, 5)
     .Any(v => v == 6)
     .Test()
     .AssertResult(false);
 }
 public void Plain_Basic()
 {
     ObservableSource.Range(1, 5)
     .Last()
     .Test()
     .AssertResult(5);
 }
Esempio n. 20
0
 public void Basic()
 {
     ObservableSource.Range(1, 5)
     .SkipWhile(v => v < 3)
     .Test()
     .AssertResult(3, 4, 5);
 }
 public void Initial_Basic()
 {
     ObservableSource.Range(1, 5)
     .Reduce(() => 0, (a, b) => a + b)
     .Test()
     .AssertResult(15);
 }
Esempio n. 22
0
 public void Skip_All()
 {
     ObservableSource.Range(1, 5)
     .SkipWhile(v => v < 6)
     .Test()
     .AssertResult();
 }
 public void Plain_Basic()
 {
     ObservableSource.Range(1, 5)
     .Reduce((a, b) => a + b)
     .Test()
     .AssertResult(15);
 }
Esempio n. 24
0
 public void Skip_None()
 {
     ObservableSource.Range(1, 5)
     .SkipWhile(v => v < 1)
     .Test()
     .AssertResult(1, 2, 3, 4, 5);
 }
 public void Main_Error()
 {
     ObservableSource.Error <int>(new InvalidOperationException())
     .OnErrorResumeNext(v => ObservableSource.Range(6, 5))
     .Test()
     .AssertResult(6, 7, 8, 9, 10);
 }
Esempio n. 26
0
 public void Predicate_Crash()
 {
     ObservableSource.Range(1, 5)
     .SkipWhile(v => throw new InvalidOperationException())
     .Test()
     .AssertFailure(typeof(InvalidOperationException));
 }
Esempio n. 27
0
 public void Handler_Completes()
 {
     ObservableSource.Range(1, 5)
     .RepeatWhen(v => v.Take(1).Skip(1))
     .Test()
     .AssertResult(1, 2, 3, 4, 5);
 }
        public void Race()
        {
            for (int i = 0; i < TestHelper.RACE_LOOPS; i++)
            {
                var ups = new MonocastSubject <int>[]
                {
                    new MonocastSubject <int>(),
                    new MonocastSubject <int>()
                };

                var to = ObservableSource.Range(0, 2)
                         .Map(v => ups[v])
                         .Merge()
                         .Test();

                TestHelper.Race(() => {
                    for (int j = 0; j < 1000; j++)
                    {
                        ups[0].OnNext(j);
                    }
                    ups[0].OnCompleted();
                }, () => {
                    for (int j = 1000; j < 2000; j++)
                    {
                        ups[1].OnNext(j);
                    }
                    ups[1].OnCompleted();
                });

                to.AssertValueCount(2000)
                .AssertNoError()
                .AssertCompleted();
            }
        }
 public void Collector_Crash()
 {
     ObservableSource.Range(1, 5)
     .Collect(() => new List <int>(), (a, b) => throw new InvalidOperationException())
     .Test()
     .AssertFailure(typeof(InvalidOperationException));
 }
Esempio n. 30
0
 public void Overlap_Basic_3_2()
 {
     ObservableSource.Range(1, 10)
     .Window(3, 2)
     .FlatMap(v => v.ToList())
     .Test()
     .AssertResult(
         new List <int>()
     {
         1, 2, 3
     },
         new List <int>()
     {
         3, 4, 5
     },
         new List <int>()
     {
         5, 6, 7
     },
         new List <int>()
     {
         7, 8, 9
     },
         new List <int>()
     {
         9, 10
     }
         );
 }