Exemple #1
0
        public void Test_ShouldThrowInvalidOperationExceptionWhenStartingAgain()
        {
            var stoper = new MyStoper();

            stoper.Start();

            Assert.Throws <InvalidOperationException>(() => stoper.Start());
        }
Exemple #2
0
        public void Test_ShouldThrowArgumentExceptionWhenRunning()
        {
            var stoper = new MyStoper();

            stoper.Start();

            Assert.Throws <ArgumentException>(() => stoper.Time);
        }
Exemple #3
0
        public void Test_ShouldThrowInvalidOperationExceptionAfterRestarting()
        {
            var stoper = new MyStoper();

            stoper.Start();
            stoper.Stop();
            stoper.Restart();

            Assert.Throws <ArgumentException>(() => stoper.Time);
        }
Exemple #4
0
        public void Test_ShouldReturnNotNullTime()
        {
            var stoper = new MyStoper();

            stoper.Start();
            stoper.Stop();
            stoper.Start();
            stoper.Stop();

            double?time = stoper.Time;

            Assert.True(time is not null);
        }