public virtual void TestSubListJava() { System.Collections.IList l = new System.Collections.ArrayList(); l.Add("param1"); l.Add("param2"); l.Add("param3"); l.Add("param4"); int fromIndex = 1; int size = 2; int endIndex = fromIndex + size; System.Collections.IList l2 = l.SubList(fromIndex, endIndex); AssertEquals(2, l2.Count); }
public virtual void TestSubListJava3() { System.Collections.IList l = new System.Collections.ArrayList(); int fromIndex = 100; int size = 20; int endIndex = fromIndex + size; bool throwException = false; if (!throwException) { if (fromIndex > l.Count - 1) { fromIndex = 0; } if (endIndex > l.Count) { endIndex = l.Count; } } System.Collections.IList l2 = l.SubList(fromIndex, endIndex); AssertEquals(0, l2.Count); }
public virtual void TestSubListJava2() { System.Collections.IList l = new System.Collections.ArrayList(); l.Add("param1"); l.Add("param2"); l.Add("param3"); l.Add("param4"); int fromIndex = 1; int size = 20; int endIndex = fromIndex + size; bool throwException = false; if (!throwException) { if (endIndex > l.Count) { endIndex = l.Count; } } System.Collections.IList l2 = l.SubList(fromIndex, endIndex); AssertEquals(3, l2.Count); }
/// <summary>Test when start index is greater than list size</summary> public virtual void TestSubListJava3() { System.Collections.IList l = new System.Collections.ArrayList(); int fromIndex = 100; int size = 20; int endIndex = fromIndex + size; bool throwException = false; if (!throwException) { if (fromIndex > l.Count - 1) { fromIndex = 0; } if (endIndex > l.Count) { endIndex = l.Count; } } System.Collections.IList l2 = l.SubList(fromIndex, endIndex); AssertEquals(0, l2.Count); }
/// <summary>Test when size is bigger than list</summary> public virtual void TestSubListJava2() { System.Collections.IList l = new System.Collections.ArrayList(); l.Add("param1"); l.Add("param2"); l.Add("param3"); l.Add("param4"); int fromIndex = 1; int size = 20; int endIndex = fromIndex + size; bool throwException = false; if (!throwException) { if (endIndex > l.Count) { endIndex = l.Count; } } System.Collections.IList l2 = l.SubList(fromIndex, endIndex); AssertEquals(3, l2.Count); }