⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 weektimingtest.cs

📁 基于LINQ和.NET 3.5 的数据库源码
💻 CS
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -