public void GetMajorityElement_NoMajorityElement_ThrowsException() { Exception exception = null; try { int[] x = new int[] { 10, 9, 8, 7, 6, 4, 3, 2 }; MajorityUnsortedArray.GetMajorityElement(x); } catch (Exception ex) { exception = ex; } Assert.IsNotNull(exception); }
public void GetMajorityElement_2IsMajorityElement_Returns2() { int[] x = new int[] { 10, 9, 8, 7, 6, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; Assert.AreEqual(2, MajorityUnsortedArray.GetMajorityElement(x)); }