public void Test_beacon_StateFns() { // Arrange beacon bc = new beacon(); int[] testArray = new int[] { 1, 2, 3, 4, 5 }; int[] signalArray = new int[5]; int[] assertArray = new int[] { 1, 0, 2, 0, 3 }; // Act bc.setSeq(testArray); for (int i = 0; i < signalArray.Length; i++) { if (i % 2 == 0) { bc.turnOn(); } else { bc.turnOff(); } signalArray[i] = bc.signal(); } // Assert CollectionAssert.AreEqual(signalArray, assertArray); }
public void Test_beacon_SignalSetSeq() { // Arrange beacon bc = new beacon(); int[] testArray = new int[] { 1, 2, 3, 4, 5 }; int[] signalArray = new int[5]; int[] assertArray = new int[] { 1, 2, 3, 4, 5 }; // Act bc.setSeq(testArray); for (int i = 0; i < signalArray.Length; i++) { signalArray[i] = bc.signal(); } // Assert CollectionAssert.AreEqual(signalArray, assertArray); }
public void Test_beacon_ChargeFns() { // Arrange beacon bc = new beacon(); int[] testArray = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int[] signalArray = new int[11]; int[] assertArray = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0 }; // Act bc.setSeq(testArray); for (int i = 0; i < signalArray.Length; i++) { signalArray[i] = bc.signal(); } bc.recharge(5); // Assert Assert.AreEqual(bc.getCharge(), 5); CollectionAssert.AreEqual(signalArray, assertArray); }