/// <summary> /// /// Records that a ship has been hit in the current battle. Will only /// record that a ship has been hit, not the number of /// times it has been hit. /// </summary> /// <param name="indexOfShipHit"></param> private void UpdateBattleInformation(int indexOfShipHit) { if (ArrayUtils.ArrayContainsNumber(ShipsHitInCurrentBattle, indexOfShipHit)) { return; } ShipsHitInCurrentBattle = ArrayUtils.AddNumber(ShipsHitInCurrentBattle, indexOfShipHit); }
public void TestAddNumberToArray() { int[] numbers = { 1, 3, 6, 4, 2 }; numbers = ArrayUtils.AddNumber(numbers, 5); Assert.That(numbers.Length, Is.EqualTo(6)); Assert.That(numbers[5], Is.EqualTo(5)); Assert.That(ArrayUtils.ArrayContainsNumber(numbers, 5)); }