public void IncDecSecondIntervalTest() { CommandIncDec com = new CommandIncDec(); ClockEventArgs args = new ClockEventArgs(0, 0, int.MinValue); // com.Clock = MockClock.Instance; com.Clock.Set(0, 0, 30); com.Execute(args); Assert.AreEqual(29, com.Clock.Second); args = new ClockEventArgs(0, 0, -1); com.Execute(args); Assert.AreEqual(28, com.Clock.Second); args = new ClockEventArgs(0, 0, 0); com.Execute(args); Assert.AreEqual(28, com.Clock.Second); args = new ClockEventArgs(0, 0, 1); com.Execute(args); Assert.AreEqual(29, com.Clock.Second); args = new ClockEventArgs(0, 0, int.MaxValue); com.Execute(args); Assert.AreEqual(30, com.Clock.Second); }
public void IncDecHourIntervalTest() { CommandIncDec com = new CommandIncDec(); ClockEventArgs args = new ClockEventArgs(int.MinValue, 0, 0); // com.Clock = MockClock.Instance; com.Clock.Set(12, 0, 0); com.Execute(args); Assert.AreEqual(11, com.Clock.Hour); args = new ClockEventArgs(-1, 0, 0); com.Execute(args); Assert.AreEqual(10, com.Clock.Hour); args = new ClockEventArgs(0, 0, 0); com.Execute(args); Assert.AreEqual(10, com.Clock.Hour); args = new ClockEventArgs(1, 0, 0); com.Execute(args); Assert.AreEqual(11, com.Clock.Hour); args = new ClockEventArgs(int.MaxValue, 0, 0); com.Execute(args); Assert.AreEqual(12, com.Clock.Hour); }
public void CommandIncDecExecutesCorrectly() { CommandIncDec incdec = new CommandIncDec(); ClockEventArgs args = new ClockEventArgs(9, 9, 9); incdec.Clock = MockClock.Instance; incdec.Execute(args); Assert.AreEqual(true, MockClock.Instance.IncDecExecuted); Assert.AreEqual(-9, args.Hour); Assert.AreEqual(-9, args.Minute); Assert.AreEqual(-9, args.Second); MockClock.Instance.ResetMock(); }