Beispiel #1
0
        public void StartNewWithZeroPeriodShoultThrowArgumentException(int period)
        {
            // Arrange
            var timeLoop = new TimeLoop();

            // Act
            // Assert
            Assert.Throws(typeof(ArgumentException), () => { timeLoop.StartNew(id => { }, period); });
        }
Beispiel #2
0
        public void StartNewWithNullActionShoultThrowArgumentNullException()
        {
            // Arrange
            var timeLoop = new TimeLoop();

            // Act
            // Assert
            Assert.Throws(typeof(ArgumentNullException), () => { timeLoop.StartNew(null, 10); });
        }
Beispiel #3
0
        public void StartNewWithValidActionAndPeriodShouldReturnGuid()
        {
            // Arrange
            var timeLoop = new TimeLoop();

            // Act
            var result = timeLoop.StartNew(id => { }, 10);

            // Assert
            Assert.Equal(typeof(Guid), result.GetType());
        }
Beispiel #4
0
        public void StopWithTimerShouldReturnTrue()
        {
            // Arrange
            var timeLoop = new TimeLoop();

            // Act
            var loopId = timeLoop.StartNew(id => { }, 10);
            var result = timeLoop.Stop(loopId);

            // Assert
            Assert.Equal(true, result);
        }