public void LastIndexTest() { ICollection arr = GetList(); int expected = 3; int actual; actual = ICollectionExt.LastIndex(arr); EAssert.AreEqual(expected, actual); }
public void ToStringTest() { ICollection arr = GetList(); string separator = ";"; string expected = "1;2;3;4"; string actual; actual = arr.ToString(separator); EAssert.AreEqual(expected, actual); }
public void EGetRangeTest1() { IList <int> coll = GetList(); int startIndex = 2; List <int> expected = new List <int> { 3, 4 }; List <int> actual; actual = IListExt.EGetRange <int>(coll, startIndex); EAssert.AreEqual(actual, expected); }
public void RemoveRangeTest() { ICollection <int> coll = GetList(); IEnumerable <int> items = new List <int> { 1, 3 }; IEnumerable <int> expected = new List <int> { 2, 4 }; ICollectionExt.RemoveRange <int>(coll, items); EAssert.AreEqual(coll, expected); }
public void CutTest() { List <int> coll = GetList(); Func <int, bool> predicate = (int i) => (i > 1); List <int> expected = new List <int>() { 2, 3, 4 }; List <int> actual; actual = ICollectionExt.Cut <int>(coll, predicate); EAssert.AreEqual(actual, expected); EAssert.AreEqual(coll.Count, 1); }
public void EGetRangeTest() { IList <int> coll = GetList(); int startIndex = 1; int count = 2; List <int> expected = new List <int>() { 2, 3 }; List <int> actual; actual = IListExt.EGetRange <int>(coll, startIndex, count); EAssert.AreEqual(actual, expected); }
public void SplitByIndexTest() { IList <int> coll = GetList(); int index = 2; bool excludeSplittingItem = true; List <int>[] expected = new List <int>[] { new List <int>() { 1, 2 }, new List <int>() { 4 } }; List <int>[] actual; actual = coll.SplitByIndex <int>(index, excludeSplittingItem); EAssert.AreEqual(actual, expected); }