public void Test_isActive_dataMod() { // Arrange int[] seq = new int[] { 1, 9, 3, 7, 5, 6, 4, 8, 2, 10 }; int prime = 7; dataMod obj = new dataMod(prime, seq); int[] expectedLARGE = new int[] { 10, 9, 8, 4, 6, 2, 2, 2, 2, 1 }; int[] expectedSMALL = new int[] { 1, 2, 2, 2, 2, 6, 4, 8, 9, 10 }; int[] expectedInactiveSeq = null; bool expectedActive = false; // Act int[] resultLARGE = obj.scramble(); obj.switchMode(); int[] resultSMALL = obj.scramble(); obj.switchMode(); int[] resultInactive = obj.scramble(); bool activeState = obj.getActiveStatus(); // Assert CollectionAssert.AreEqual(resultLARGE, expectedLARGE); CollectionAssert.AreEqual(resultSMALL, expectedSMALL); CollectionAssert.AreEqual(resultInactive, expectedInactiveSeq); Assert.AreEqual(activeState, expectedActive); }
public void Test_scramble_dataMod() { // Arrange int[] seq = new int[] { 1, 9, 3, 7, 5, 6, 4, 8, 2, 10 }; int prime = 7; dataMod objLARGE = new dataMod(prime, seq); dataMod objSMALL = new dataMod(prime, seq); dataMod objNullLARGE = new dataMod(prime); dataMod objNullSMALL = new dataMod(prime); int[] expectedLARGE = new int[] { 10, 9, 8, 4, 6, 2, 2, 2, 2, 1 }; int[] expectedSMALL = new int[] { 1, 2, 2, 2, 2, 6, 4, 8, 9, 10 }; int[] expectedNullLARGE = expectedLARGE; int[] expectedNullSMALL = expectedSMALL; // Act objSMALL.switchMode(); objNullSMALL.switchMode(); int[] resultLARGE = objLARGE.scramble(); int[] resultSMALL = objSMALL.scramble(); int[] resultNullLARGE = objNullLARGE.scramble(seq); int[] resultNullSMALL = objNullSMALL.scramble(seq); // Assert CollectionAssert.AreEqual(resultLARGE, expectedLARGE); CollectionAssert.AreEqual(resultSMALL, expectedSMALL); CollectionAssert.AreEqual(resultNullLARGE, expectedNullLARGE); CollectionAssert.AreEqual(resultNullSMALL, resultNullSMALL); }
public void Test_dataMod_ScrambleOddLengthSeq() { // Arrange dataMod d = new dataMod(); int[] testArray = new int[7] { 8, 24, 30, 31, 6, 11, 66 }; int[] assertArray = new int[7] { 8, 24, 2, 30, 2, 6, 66 }; // Act int[] dScramble = d.scramble(testArray); // Assert CollectionAssert.AreEqual(dScramble, assertArray); }
public void Test_dataMod_ScrambleLargeMode() { // Arrange dataMod d = new dataMod(); d.setMode(true); int[] testArray = new int[6] { 8, 24, 30, 31, 6, 11 }; int[] assertArray = new int[6] { 24, 8, 30, 2, 6, 2 }; // Act int[] dScramble = d.scramble(testArray); // Assert CollectionAssert.AreEqual(dScramble, assertArray); }
public void Test_dataMod_FilterSmallMode() { // Arrange dataMod d = new dataMod(13); int[] testArray = new int[6] { 8, 24, 30, 31, 6, 11 }; int[] assertArray = new int[4] { 7, 1, 5, 1 }; // Act d.scramble(testArray); // NOTE: All prime numbers will be replaced with '2' before updating int[] dFilter = d.filter(); // Assert CollectionAssert.AreEqual(dFilter, assertArray); }