Beispiel #1
0
        public void ShouldDoNothingForSetAmountOfTime()
        {
            // Given
            const double accuracyOfTimeMeasurementInMilliseconds = 25d;
            const double millisecondsToSleep = 500d;
            var          stopwatch           = new Stopwatch();

            stopwatch.Reset();

            var template = new SleeperTemplate {
                SleepTimeInMilliseconds = (int)millisecondsToSleep
            };
            var sleeper = new Sleeper(template);

            // When
            stopwatch.Start();
            sleeper.ProcessImage(null);
            stopwatch.Stop();

            // Then
            Assert.AreEqual(millisecondsToSleep, stopwatch.ElapsedMilliseconds, accuracyOfTimeMeasurementInMilliseconds);
        }