当前位置: 首页>>代码示例>>C#>>正文


C# Timeline.PendingAlertsAt方法代码示例

本文整理汇总了C#中Timeline.PendingAlertsAt方法的典型用法代码示例。如果您正苦于以下问题:C# Timeline.PendingAlertsAt方法的具体用法?C# Timeline.PendingAlertsAt怎么用?C# Timeline.PendingAlertsAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Timeline的用法示例。


在下文中一共展示了Timeline.PendingAlertsAt方法的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());
            }
        }
开发者ID:BaldnessMage,项目名称:act_timeline,代码行数:46,代码来源:TimelineTest.cs


注:本文中的Timeline.PendingAlertsAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。