public void CountingSheep_CountSheep_RandomTests() { var numbers = new bool[rnd.Next(0, 100)]; for (int i = 0; i < numbers.Length; i++) { numbers[i] = rnd.Next(2) == 2; int expected = solution(numbers); int actual = CountingSheep.CountSheep(numbers); Assert.AreEqual(expected, actual); } }
public void CountingSheep_CountSheep_NumberOfTruesInArrayReturned() { var sheeps = new bool[] { true, false, true }; Assert.AreEqual(2, CountingSheep.CountSheep(sheeps)); sheeps = new bool[] { true, false, true, true, false, true, true, false, true }; Assert.AreEqual(6, CountingSheep.CountSheep(sheeps)); sheeps = new bool[] { true, true, true, true, true, true, true, true, true }; Assert.AreEqual(9, CountingSheep.CountSheep(sheeps)); sheeps = new bool[] { false, false, false, false, false, false, false, false, false, false, false, false }; Assert.AreEqual(0, CountingSheep.CountSheep(sheeps)); }
public void CountingSheep_CountSheep_SampleTest() { var sheeps = new bool[] { true, false, true }; Assert.AreEqual(2, CountingSheep.CountSheep(sheeps)); }