Ejemplo n.º 1
0
        public void TestOneDayOnce()
        {
            MockMiscProvider.MockNow = (new DateTime(2004, 3, 5, 7, 10, 2, 0));
            ITiming t = new DayTiming(new TimeOfDayStructure(7, 12, 3));

            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.MockNow = (new DateTime(2004, 3, 5, 7, 12, 2, 0));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(0, 0, 10));
            Assert.AreEqual(true, t.TimesUp());

            t.Reset();
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(0, 0, 1));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(0, 0, 10));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(0, 0, 20));
            Assert.AreEqual(false, t.TimesUp());
        }
Ejemplo n.º 2
0
        public void TestIt()
        {
            MockMiscProvider.MockNow = (new DateTime(2004, 3, 5, 10, 5, 10, 0));
            ITiming t = new DayTiming(new TimeOfDayStructure(7, 12, 3));

            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(1, 2, 3));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.MockNow = (new DateTime(2004, 3, 6, 1, 0, 0));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(2, 2, 1));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(2, 6, 9));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(1, 51, 49));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.MockNow = (new DateTime(2004, 3, 6, 7, 12, 1));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(0, 0, 1));
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(0, 0, 1));
            Assert.AreEqual(true, t.TimesUp());

            t.Reset();
            Assert.AreEqual(false, t.TimesUp());

            MockMiscProvider.Add(new TimeSpan(0, 0, 1));
            Assert.AreEqual(false, t.TimesUp());
        }