Exemplo n.º 1
0
        public void Test_ShouldThrowInvalidOperationExceptionWhenStartingAgain()
        {
            var stoper = new MyStoper();

            stoper.Start();

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

            stoper.Start();

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

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

            Assert.Throws <ArgumentException>(() => stoper.Time);
        }
Exemplo n.º 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);
        }