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

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

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

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

            // Assert
            Assert.Equal(typeof(Guid), result.GetType());
        }
예제 #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);
        }