public void ToBigTest() { int elemnt = 88555; List <int> list = Enumerable.Range(1, 100000).ToList(); list.Remove(elemnt); int[] A = list.ToArray(); Assert.AreEqual(elemnt, MissingElement.Solution(A)); }
public void ElementOutOfRangeTest() { bool catchException = false; try { MissingElement.Solution(new [] { 1, 4 }); } catch (ArgumentOutOfRangeException) { catchException = true; } if (catchException) { Assert.Pass(); } else { Assert.Fail(); } }
public void ArgumentNullTest() { bool catchException = false; try { MissingElement.Solution(null); } catch (ArgumentNullException) { catchException = true; } if (catchException) { Assert.Pass(); } else { Assert.Fail(); } }
public void LastElementTest() { Assert.AreEqual(6, MissingElement.Solution(new [] { 1, 3, 5, 4, 2 })); }
public void FirstElemntTest() { Assert.AreEqual(1, MissingElement.Solution(new [] { 2, 5, 4, 3, 6 })); }
public void ZeroElementsTest() { Assert.AreEqual(1, MissingElement.Solution(new int[0])); }
public void OneElementTest() { Assert.AreEqual(2, MissingElement.Solution(new[] { 1 })); }
public void TwoElementsTest() { Assert.AreEqual(2, MissingElement.Solution(new[] { 1, 3 })); }
public void SortedArrayTest() { Assert.AreEqual(4, MissingElement.Solution(new [] { 1, 2, 3, 5, 6, 7 })); }