コード例 #1
0
ファイル: Command.cs プロジェクト: BubbaFatAss/NzbDrone
        protected Command()
        {
            Name = GetType().Name.Replace("Command", "");
            StateChangeTime = DateTime.UtcNow;
            State = CommandStatus.Pending;
            _stopWatch = new StopWatch();

            lock (Mutex)
            {
                Id = ++_idCounter;
            }
        }
コード例 #2
0
		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);
		}