Example #1
0
        public void PerformStateOperation_IncreasesCounterBy1()
        {
            ValidState state = new ValidState(null, 100, TimeSpan.FromSeconds(5));

            Assert.AreEqual(0, state.CurrentCount);
            state.PerformStateOperation();
            Assert.AreEqual(1, state.CurrentCount);
            state.PerformStateOperation();
            Assert.AreEqual(2, state.CurrentCount);
        }
Example #2
0
        public void Next_WhenNotExpiredAndLimitNotExceeded_ReturnsSameInstance()
        {
            ValidState state = new ValidState(null, 100, TimeSpan.FromSeconds(5));
            var        next  = state.Next();

            Assert.AreSame(state, next);
            state.PerformStateOperation();
            next = state.Next();
            Assert.AreSame(state, next);
        }