public void WhenListsAreSameThenContainsShouldReturnTrue() { List <int> sourceList = new List <int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; Assert.IsTrue(IEnumerableUtil.Contains(sourceList, sourceList)); }
public void WhenOtherListIsEmptyAndOtherDontThenContainsShouldReturnFalse() { List <int> sourceList = new List <int>() { 2, 3, 4, 5, 6, 7, 8, 9, 1, 1 }; List <int> otherList = new List <int>() { }; Assert.IsFalse(IEnumerableUtil.Contains(sourceList, otherList)); }
public void WhenBothListsContainsDuplicatesThenContainsShouldReturnTrue() { List <int> sourceList = new List <int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 1 }; List <int> otherList = new List <int>() { 2, 3, 4, 5, 6, 7, 8, 9, 1, 1 }; Assert.IsTrue(IEnumerableUtil.Contains(sourceList, otherList)); }
public void WhenListsContainsDifferentElementsThenContainsShouldReturnFalse() { List <int> sourceList = new List <int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; List <int> otherList = new List <int>() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Assert.IsFalse(IEnumerableUtil.Contains(sourceList, otherList)); }
public void WhenListsContainsSameElementsButInDifferentOrderThenContainsShouldReturnTrue() { List <int> sourceList = new List <int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; List <int> otherList = new List <int>() { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; Assert.IsTrue(IEnumerableUtil.Contains(sourceList, otherList)); }
public void WhenOtherListIsNullThenContainsShouldThrowArgumentNullException() { Assert.ThrowsException <ArgumentNullException>(() => IEnumerableUtil.Contains(new List <int>() { }, null)); }