예제 #1
0
        public void Test_Revive_whenActive()
        {
            //arrange
            int       number = 2488;
            jumpPrime obj    = new jumpPrime(number);

            //act
            obj.revive();
            bool expectedState = false;

            //assert
            Assert.AreEqual(expectedState, obj.getActive());
        }
예제 #2
0
        public void Test_Down_into_Inactive()
        {
            //arrange
            int       number = 1000;
            jumpPrime obj    = new jumpPrime(number);
            //act
            int  expectedInt   = 0;
            bool expectedState = false;

            //assert
            Assert.AreEqual(expectedInt, obj.down());
            Assert.AreEqual(expectedState, obj.getActive());
        }
예제 #3
0
        public void Test_Up_into_Inactive()
        {
            //arrange
            int       number = 2488;
            jumpPrime obj    = new jumpPrime(number);
            int       limit  = 26; //bounds should be 26
            //act
            int  expectedInt   = 0;
            bool expectedState = false;

            for (int i = 0; i < limit; i++)
            {
                obj.up();
            }
            //assert
            Assert.AreEqual(expectedInt, obj.up());
            Assert.AreEqual(expectedState, obj.getActive());
        }
예제 #4
0
        public void Test_Revive()
        {
            //arrange
            int       number        = 2488;
            jumpPrime obj           = new jumpPrime(number);
            int       limitExceeded = 27;

            //act
            for (int i = 0; i < limitExceeded; i++)
            {
                obj.up();
            }
            bool expectedValue = true;

            obj.revive();
            //assert
            Assert.AreEqual(expectedValue, obj.getActive());
        }
예제 #5
0
        public void Test_Reset()
        {
            //arrange
            int       number = 2488;
            jumpPrime obj    = new jumpPrime(number);
            int       limit  = 14; //uppper prime is 2503 & max number of queries is 26
            //act
            bool expectedState = true;

            for (int i = 0; i < limit; i++)
            {
                obj.up();
            }
            obj.reset();    //num of queries should be zero
            for (int i = 0; i < limit; i++)
            {
                obj.up();
            }
            //even though we query 28 times over the bounds of 26, we reset so it should still be active
            //assert
            Assert.AreEqual(expectedState, obj.getActive());
        }