public void Cannot_be_stopped_multiple_times() { _timer.Start(); _timer.Stop(); Action stop = () => _timer.Stop(); stop.ShouldThrow <InvalidOperationException>(); }
public void Cannot_be_stopped_multiple_times() { _timer.Start(); _stopwatch.IsRunning.Returns(true); _timer.Stop(); _stopwatch.IsRunning.Returns(false); Action stop = () => _timer.Stop(); stop.ShouldThrow <InvalidOperationException>(); }
public void Timer_calls_the_callback_with_elapsed_milliseconds() { var elapsedMilliseconds = 0L; var timer = new OkanshiTimer(x => elapsedMilliseconds = x); timer.Start(); Thread.Sleep(500); timer.Stop(); elapsedMilliseconds.Should().BeInRange(400, 700); }