public void ShouldFindIndexOfDominator(int[] A, int expected) { Dominator dominator = new Dominator(); int actual = dominator.Find(A); Assert.AreEqual(expected, actual); }
public void test_solution_givenArray_returnsDominator(int[] given, int[] expected) { var target = new Dominator(); var actual = target.solution(given); CollectionAssert.Contains(expected, actual); }
public void Dominator_Should_Handle_Simple_Array() { Dominator subject = new Dominator(); int[] array = { 3, 4, 3, 2, 3, -1, 3, 3 }; int result = subject.solution(array); Assert.Equal(0, result); }
public void Dominator_Should_Handle_Equal_Array() { Dominator subject = new Dominator(); int[] array = { 3, 3, 3, 3, 5, 4, 4, 4, 4 }; int result = subject.solution(array); Assert.Equal(-1, result); }
public void Dominator_Should_Handle_Single_Entry_Array() { Dominator subject = new Dominator(); int[] array = { 3 }; int result = subject.solution(array); Assert.Equal(0, result); }
public void DominatorSolutionTest() { var dominator = new Dominator(); int[] array = { 3, 4, 3, 2, 3, -1, 3, 3 }; int result = dominator.Solve(array); Assert.IsTrue(result == 0 || result == 2 || result == 4 || result == 6 || result == 7); //No dominator array = new int[] { 1, 2, 3 }; result = dominator.Solve(array); Assert.AreEqual(-1, result); //Array of size 1 array = new int[] { 1 }; result = dominator.Solve(array); Assert.AreEqual(0, result); array = new int[0]; result = dominator.Solve(array); Assert.AreEqual(-1, result); }
public void Initialize() { _dominator = new Dominator(); }