public void Shared() { IExecutorService[] execs = { Executors.Single, Executors.Computation, Executors.IO }; foreach (var exec in execs) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { Flowable.Just(1).SubscribeOn(exec) .Test() .WithTag("SubscribeOn round " + i + "/" + j + " - " + exec.GetType().Name) .AwaitDone(TimeSpan.FromSeconds(5)) .AssertResult(1); Flowable.Just(1).Delay(TimeSpan.FromMilliseconds(10)) .Test() .WithTag("Delay round " + i + "/" + j + " - " + exec.GetType().Name) .AwaitDone(TimeSpan.FromSeconds(5)) .AssertResult(1); Flowable.Interval(TimeSpan.FromMilliseconds(10)) .Take(5) .Test() .WithTag("Interval round " + i + "/" + j + " - " + exec.GetType().Name) .AwaitDone(TimeSpan.FromSeconds(5)) .AssertResult(0L, 1L, 2L, 3L, 4L); } } } }
public void Normal() { var ts = Flowable.Interval(TimeSpan.FromMilliseconds(10)) .Take(10) .Test() ; ts.AwaitDone(TimeSpan.FromSeconds(500)) .AssertResult(0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L); }
public void Normal() { Flowable.Interval(TimeSpan.FromMilliseconds(2)) .Map(v => { Console.WriteLine(1); return(1); }) .Sample(TimeSpan.FromMilliseconds(10)) .Take(10) .Test() .AwaitCount(10, () => Thread.Sleep(10), TimeSpan.FromSeconds(5)) .ThenCancel() .AssertValues(1, 1, 1, 1, 1, 1, 1, 1, 1, 1) .AssertNoError(); }
public override IPublisher <long> CreatePublisher(long elements) { return(Flowable.Interval(TimeSpan.FromMilliseconds(1), Executors.Task).Take(elements)); }