本文整理汇总了C#中TestScheduler.Sleep方法的典型用法代码示例。如果您正苦于以下问题:C# TestScheduler.Sleep方法的具体用法?C# TestScheduler.Sleep怎么用?C# TestScheduler.Sleep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestScheduler
的用法示例。
在下文中一共展示了TestScheduler.Sleep方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SampleIntrospective
public void SampleIntrospective()
{
var scheduler = new TestScheduler();
var source = scheduler.CreateHotObservable(
OnNext(110, "A"),
OnNext(120, "B"),
OnNext(130, "C"),
OnNext(140, "D"),
// ... delay ...
OnNext(180, "E"),
OnNext(190, "F"),
OnNext(200, "G"), OnNext(201, "H"), OnNext(202, "I"), // burst
// ... delay ...
OnNext(250, "J"),
// ... delay ...
OnNext(300, "K"), OnNext(302, "L"), OnNext(304, "M"), // burst
// complete
OnCompleted<string>(304),
OnNext(305, "N")
);
var sampledSource = source.SampleIntrospective(scheduler)
.Do(_ => scheduler.Sleep(15));
AssertEqual(
scheduler.Start(() => sampledSource, created: 0, subscribed: 0, disposed: 10000).Messages,
OnNext(126, "A"),
OnNext(142, "B"),
// skipping "C"
OnNext(158, "D"),
OnNext(196, "E"),
OnNext(212, "F"),
// skipping "G"
// skipping "H"
OnNext(228, "I"),
OnNext(266, "J"),
OnNext(316, "K"),
// skipping "L", "M"
OnCompleted<string>(317));
}