本文整理汇总了C#中Timeline.FindFirstAlertIndexAfterStartTime方法的典型用法代码示例。如果您正苦于以下问题:C# Timeline.FindFirstAlertIndexAfterStartTime方法的具体用法?C# Timeline.FindFirstAlertIndexAfterStartTime怎么用?C# Timeline.FindFirstAlertIndexAfterStartTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timeline
的用法示例。
在下文中一共展示了Timeline.FindFirstAlertIndexAfterStartTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AlertLookupShouldReturnValidResults
public void AlertLookupShouldReturnValidResults()
{
TimelineActivity activity = new TimelineActivity { TimeFromStart = 10 };
List<TimelineActivity> activities = new List<TimelineActivity>() { activity };
List<ActivityAlert> alerts = new List<ActivityAlert>();
for (int i = 0; i < 10; ++i)
alerts.Add(new ActivityAlert { ReminderTimeOffset = (double)i, Activity = activity });
Timeline t = new Timeline("foobar", activities, new List<TimelineAnchor>(), alerts, new AlertSoundAssets());
// t.alertsTimeFromStart == 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Assert.AreEqual(4, t.FindFirstAlertIndexAfterStartTime(4.9));
Assert.AreEqual(5, t.FindFirstAlertIndexAfterStartTime(5));
Assert.AreEqual(5, t.FindFirstAlertIndexAfterStartTime(5.1));
{
var pending = t.PendingAlertsAt(0);
CollectionAssert.AreEqual(
new List<double> { },
pending.Select(a => a.TimeFromStart).ToList());
}
{
var pending = t.PendingAlertsAt(1.1);
CollectionAssert.AreEqual(
new List<double> { 1.0 },
pending.Select(a => a.TimeFromStart).ToList());
}
{
var pending = t.PendingAlertsAt(2.1);
CollectionAssert.AreEqual(
new List<double> { 1.0, 2.0 },
pending.Select(a => a.TimeFromStart).ToList());
}
{
var pending = t.PendingAlertsAt(3.1);
CollectionAssert.AreEqual(
new List<double> { 1.0, 2.0, 3.0 },
pending.Select(a => a.TimeFromStart).ToList());
}
{
var pending = t.PendingAlertsAt(5.1);
CollectionAssert.AreEqual(
new List<double> { 3.0, 4.0, 5.0 },
pending.Select(a => a.TimeFromStart).ToList());
}
}