weektimingtest.cs
来自「基于LINQ和.NET 3.5 的数据库源码」· CS 代码 · 共 54 行
CS
54 行
using System;
using Lephone.Util.TimingTask;
using Lephone.Util.TimingTask.Timings;
using NUnit.Framework;
namespace Lephone.UnitTest.util.timingTask
{
[TestFixture]
public class WeekTimingTest
{
[Test]
public void TestIt()
{
MockNowTimeProvider ntp = new MockNowTimeProvider(new DateTime(2004,11,21,7,10,2,0));
ITiming t = new WeekTiming(new TimeOfDayStructure(7, 12, 3), DayOfWeek.Monday, ntp);
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,22,7,10,2));
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,22,7,12,2));
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,22,7,12,3));
Assert.AreEqual(true, t.TimesUp());
t.Reset();
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,23,7,12,4));
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,24,7,12,4));
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,25,7,12,4));
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,26,7,12,4));
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,27,7,12,4));
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,28,7,12,4));
Assert.AreEqual(false, t.TimesUp());
ntp.SetNow(new DateTime(2004,11,29,7,12,4));
Assert.AreEqual(true, t.TimesUp());
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?