public void Overlap_Empty() { ObservableSource.Empty <int>() .Buffer(2, 1) .Test() .AssertResult(); }
public void Error_Fallback() { ObservableSource.Empty <int>() .SwitchIfEmpty(ObservableSource.Error <int>(new InvalidOperationException())) .Test() .AssertFailure(typeof(InvalidOperationException)); }
public void Default_Empty() { ObservableSource.Empty <int>() .Single(100) .Test() .AssertResult(100); }
public void Empty() { ObservableSource.Empty <int>() .Skip(1) .Test() .AssertResult(); }
public void Empty() { ObservableSource.Empty <int>() .SwitchIfEmpty(ObservableSource.Range(6, 5)) .Test() .AssertResult(6, 7, 8, 9, 10); }
public void Limited_Mixed_Long() { for (int i = 1; i < 7; i++) { ObservableSource.Range(0, 1200) .FlatMap(v => { var type = v % 6; switch (type) { case 0: return(ObservableSource.Just(v).Hide()); case 1: return(ObservableSource.Just(v)); case 2: return(ObservableSource.Range(v, 2).Hide()); case 3: return(ObservableSource.Range(v, 2)); case 4: return(ObservableSource.Empty <int>().Hide()); case 5: return(ObservableSource.Empty <int>()); } throw new InvalidOperationException(); }, maxConcurrency: i) .Test() .WithTag($"maxConcurrency: {i}") .AwaitDone(TimeSpan.FromSeconds(5)) .AssertSubscribed() .AssertValueCount(1200) .AssertNoError() .AssertCompleted(); } }
public void Error() { ObservableSource.Error <int>(new InvalidOperationException()) .Delay(v => ObservableSource.Empty <int>()) .Test() .AssertFailure(typeof(InvalidOperationException)); }
public void Regular_Empty() { ObservableSource.Empty <int>() .Map(v => v.ToString()) .Test() .AssertResult(); }
public void All_Empty() { var success = 0; var afterSuccess = 0; var completed = 0; var error = 0; var terminate = 0; var afterterminate = 0; var subscribe = 0; var dispose = 0; var final = 0; ObservableSource.Empty <int>() .DoOnNext(v => success++) .DoAfterNext(v => afterSuccess++) .DoOnCompleted(() => completed++) .DoOnError(e => error++) .DoOnTerminate(() => terminate++) .DoAfterTerminate(() => afterterminate++) .DoOnSubscribe(d => subscribe++) .DoOnDispose(() => dispose++) .DoFinally(() => final++) .Test() .AssertResult(); Assert.AreEqual(0, success); Assert.AreEqual(0, afterSuccess); Assert.AreEqual(1, completed); Assert.AreEqual(0, error); Assert.AreEqual(1, terminate); Assert.AreEqual(1, afterterminate); Assert.AreEqual(1, subscribe); Assert.AreEqual(0, dispose); Assert.AreEqual(1, final); }
public void Initial_Empty() { ObservableSource.Empty <int>() .Reduce(() => 0, (a, b) => a + b) .Test() .AssertResult(0); }
public void Plain_Empty() { ObservableSource.Empty <int>() .Reduce((a, b) => a + b) .Test() .AssertResult(); }
public void Until_Empty() { ObservableSource.Range(1, 5) .SkipUntil(ObservableSource.Empty <int>()) .Test() .AssertResult(1, 2, 3, 4, 5); }
public void Other_Basic_2() { ObservableSource.Range(1, 5) .DelaySubscription(ObservableSource.Empty <int>()) .Test() .AssertResult(1, 2, 3, 4, 5); }
public void Exact_Empty() { ObservableSource.Empty <int>() .Buffer(1) .Test() .AssertResult(); }
public void Empty() { ObservableSource.Empty <int>() .IsEmpty() .Test() .AssertResult(true); }
public void Fused_Empty() { ObservableSource.Empty <int>() .ConcatMap(v => ObservableSource.Just(9 + v)) .Test() .AssertResult(); }
public void Max_Mixed_Long() { ObservableSource.Range(0, 1200) .FlatMap(v => { var type = v % 6; switch (type) { case 0: return(ObservableSource.Just(v).Hide()); case 1: return(ObservableSource.Just(v)); case 2: return(ObservableSource.Range(v, 2).Hide()); case 3: return(ObservableSource.Range(v, 2)); case 4: return(ObservableSource.Empty <int>().Hide()); case 5: return(ObservableSource.Empty <int>()); } throw new InvalidOperationException(); }) .Test() .AwaitDone(TimeSpan.FromSeconds(5)) .AssertSubscribed() .AssertValueCount(1200) .AssertNoError() .AssertCompleted(); }
public void Regular_Empty() { ObservableSource.Empty <int>().Hide() .ConcatMap(v => ObservableSource.Just(9 + v)) .Test() .AssertResult(); }
public void Basic_Empty() { ObservableSource.Range(1, 5) .Delay(v => ObservableSource.Empty <int>()) .Test() .AssertResult(1, 2, 3, 4, 5); }
public void Plain_Empty() { ObservableSource.Empty <int>() .Single() .Test() .AssertFailure(typeof(IndexOutOfRangeException)); }
public void Scalar() { var scalar = ObservableSource.Empty <int>() as IStaticValue <int>; Assert.AreEqual(default(int), scalar.GetValue(out var success)); Assert.False(success); }
public void Sum_Long_Empty() { ObservableSource.Empty <long>() .Sum() .Test() .AssertResult(); }
public void Skip_Empty() { ObservableSource.Empty <int>() .Buffer(1, 2) .Test() .AssertResult(); }
public void Sum_Int_Empty() { ObservableSource.Empty <int>() .Sum() .Test() .AssertResult(); }
public void Min_Comparable_Empty() { ObservableSource.Empty <int>() .Min() .Test() .AssertResult(); }
public void Regular_Empty() { ObservableSource.Empty <int>() .IgnoreElements() .Test() .AssertResult(); }
public void Sum_Decimal_Empty() { ObservableSource.Empty <decimal>() .Map(v => v + 0.5m) .Sum() .Test() .AssertResult(); }
public void Sum_Double_Empty() { ObservableSource.Empty <double>() .Map(v => v + 0.5d) .Sum() .Test() .AssertResult(); }
public void Sum_Float_Empty() { ObservableSource.Empty <float>() .Map(v => v + 0.5f) .Sum() .Test() .AssertResult(); }
public void TryFirst_Empty() { var v = ObservableSource.Empty <int>() .BlockingTryFirst(out var success); Assert.False(success); Assert.AreEqual(default(int), v); }