protected Command() { Name = GetType().Name.Replace("Command", ""); StateChangeTime = DateTime.UtcNow; State = CommandStatus.Pending; _stopWatch = new StopWatch(); lock (Mutex) { Id = ++_idCounter; } }
public void CanGetTheElapsedTime() { var watch = new StopWatch(); StopWatch.TimeNow = () => new DateTime(2009, 9, 6, 15, 53, 0, 0); watch.Start(); StopWatch.TimeNow = () => new DateTime(2009, 9, 6, 15, 53, 0, 5); watch.Stop(); watch.ElapsedTime().Milliseconds.ShouldBe(5); }