예제 #1
0
        public void TestModeOnInitialization1()
        {
            //Arrange
            arithS AS = new arithS();
            string mode;

            //Act
            mode = AS.getMode();
            //Assert
            Assert.AreEqual("advance", mode);
        }
예제 #2
0
        public void TestNumGen1()
        {
            //Arrange
            arithS AS = new arithS();
            int    numGenCount;

            //Act
            numGenCount = AS.numGen();
            //Assert
            Assert.AreEqual(0, numGenCount);
        }
예제 #3
0
        public void TestQueryModeSwitches1()
        {
            //Arrange
            arithS AS = new arithS();
            int    modeSwitches;

            //Act
            modeSwitches = AS.queryModeSwitches();
            //Assert
            Assert.AreEqual(0, modeSwitches);
        }
예제 #4
0
        public void TestNext1()
        {
            //Arrange
            arithS AS = new arithS();
            int    nextcall;

            //Act
            nextcall = AS.next();
            //Assert
            Assert.AreEqual(2, nextcall);
        }
예제 #5
0
        public void TestModeOnInitialization2()
        {
            //Arrange
            int    commonDiff = 3;
            arithS AS         = new arithS(commonDiff);
            string mode;

            //Act
            mode = AS.getMode();
            //Assert
            Assert.AreEqual("advance", mode);
        }
예제 #6
0
        public void TestSwitchModes1()
        {
            //Arrange
            arithS AS = new arithS();
            string mode;

            //Act
            AS.switchMode();
            mode = AS.getMode();
            //Assert
            Assert.AreEqual("retreat", mode);
        }
예제 #7
0
        public void TestNext2()
        {
            //Arrange
            int    commonDiff = 3;
            arithS AS         = new arithS(commonDiff);
            int    nextcall;

            //Act
            nextcall = AS.next();
            //Assert
            Assert.AreEqual(3, nextcall);
        }
예제 #8
0
        public void TestQueryModeSwitches2()
        {
            //Arrange
            arithS AS = new arithS();
            int    modeSwitches;

            //Act
            AS.switchMode();
            AS.switchMode();
            modeSwitches = AS.queryModeSwitches();
            //Assert
            Assert.AreEqual(2, modeSwitches);
        }
예제 #9
0
        public void TestNumGen3()
        {
            //Arrange
            arithS AS = new arithS();
            int    numGenCount;

            //Act
            AS.next();
            AS.next();
            AS.reset();
            numGenCount = AS.numGen();
            //Assert
            Assert.AreEqual(0, numGenCount);
        }
예제 #10
0
        public void TestNext3()
        {
            //Arrange
            int    commonDiff = 4;
            arithS AS         = new arithS(commonDiff);
            int    nextcall;

            //Act
            AS.next();
            AS.next();
            nextcall = AS.next();
            //Assert
            Assert.AreEqual(12, nextcall);
        }
예제 #11
0
        public void TestMode1()
        {
            //Arrange
            int    commonDiff = 2;
            int    calls      = 6;
            arithS AS         = new arithS(commonDiff);

            int[]  forbidden = { 6, 8, 10, 12, 14 };
            string mode;

            //Act
            for (int i = 0; i < calls; i++)
            {
                AS.next();
            }
            mode = AS.getMode();
            //Assert
            Assert.AreEqual("forbidden advance", mode);
        }
예제 #12
0
        public void TestNext5()
        {
            //Arrange
            int    commonDiff = 2;
            int    calls      = 6;
            arithS AS         = new arithS(commonDiff);

            int[] forbidden = { 10, 12, 14, 16, 18 };
            AS.setForbiddenSet(forbidden);
            int nextcall;

            //Act
            for (int i = 0; i < calls; i++)
            {
                AS.next();
            }
            nextcall = AS.next();
            //Assert
            Assert.AreEqual(-1, nextcall);
        }