public void StopActivity() { Stub.On(mockTimeSystem).GetProperty("Now").Will(Return.Value(startTime)); activity = new RunningActivity("test activity", mockTimeSystem); Assert.IsTrue(activity.IsRunning); activity.Stop(); Assert.IsFalse(activity.IsRunning); }
public void SplitNames() { Stub.On(mockTimeSystem).GetProperty("Now").Will(Return.Value(startTime)); activity = new RunningActivity("first,second", mockTimeSystem); activity.Stop(); RunningActivity second = activity.SplitByComma()[1]; Assert.AreEqual("first", activity.Name); Assert.AreEqual("second", second.Name); }
public void MillisecondsAreRounded() { using (mocks.Ordered) { Expect.Once.On(mockTimeSystem).GetProperty("Now").Will(Return.Value(DateTime.Parse("2007-11-18 5:00:00"))); Expect.Once.On(mockTimeSystem).GetProperty("Now").Will(Return.Value(DateTime.Parse("2007-11-18 5:07:00.5"))); } activity = new RunningActivity("activity", mockTimeSystem); activity.Stop(); Assert.AreEqual(TimeSpan.Parse("0:07:01"), activity.Duration); }
public void Split3() { using (mocks.Ordered) { Expect.Once.On(mockTimeSystem).GetProperty("Now").Will(Return.Value(DateTime.Parse("7:00:00"))); Expect.Once.On(mockTimeSystem).GetProperty("Now").Will(Return.Value(DateTime.Parse("8:00:00"))); } activity = new RunningActivity("first, second, third", mockTimeSystem); activity.Stop(); RunningActivity third = activity.SplitByComma()[2]; Assert.AreEqual(DateTime.Parse("7:40:00"), third.Start); }
public void SplitTime() { using (mocks.Ordered) { Expect.Once.On(mockTimeSystem).GetProperty("Now").Will(Return.Value(DateTime.Parse("7:00:00"))); Expect.Once.On(mockTimeSystem).GetProperty("Now").Will(Return.Value(DateTime.Parse("8:00:00"))); } activity = new RunningActivity("first, second", mockTimeSystem); activity.Stop(); RunningActivity second = activity.SplitByComma()[1]; Assert.AreEqual(DateTime.Parse("7:00:00"), activity.Start); Assert.AreEqual(DateTime.Parse("7:30:00"), activity.End, "first end"); Assert.AreEqual(DateTime.Parse("7:30:00"), second.Start, "second start"); Assert.AreEqual(DateTime.Parse("8:00:00"), second.End); }
public void ThereIsNoNegativeDuration() { using (mocks.Ordered) { Expect.Once.On(mockTimeSystem).GetProperty("Now").Will( Return.Value(DateTime.Parse("2111-11-11 5:00:00"))); Expect.Once.On(mockTimeSystem).GetProperty("Now").Will( Return.Value(DateTime.Parse("2111-11-11 5:00:00.6"))); Expect.Once.On(mockTimeSystem).GetProperty("Now").Will( Return.Value(DateTime.Parse("2111-11-11 5:00:00.7"))); } activity = new RunningActivity("first", mockTimeSystem); activity.Stop(); activity = RunningActivity.After(activity, "second"); Assert.AreEqual(TimeSpan.Parse("0:00:00"), activity.Duration); }
public void ThereIsNoNegativeDuration() { using (mocks.Ordered) { Expect.Once.On(mockTimeSystem).GetProperty("Now").Will( Return.Value(DateTime.Parse("2111-11-11 5:00:00"))); Expect.Once.On(mockTimeSystem).GetProperty("Now").Will( Return.Value(DateTime.Parse("2111-11-11 5:00:00.6"))); Expect.Once.On(mockTimeSystem).GetProperty("Now").Will( Return.Value(DateTime.Parse("2111-11-11 5:00:00.7"))); } activity = new RunningActivity("first",mockTimeSystem); activity.Stop(); activity = RunningActivity.After(activity, "second"); Assert.AreEqual(TimeSpan.Parse("0:00:00"),activity.Duration); }
public void StopActivity() { Stub.On(mockTimeSystem).GetProperty("Now").Will(Return.Value(startTime)); activity = new RunningActivity("test activity",mockTimeSystem); Assert.IsTrue(activity.IsRunning); activity.Stop(); Assert.IsFalse(activity.IsRunning); }