public void SetTest() { int count = 100; LxList <int> list = InitList(count); Assert.Catch <LxException>(() => { list.Set(-1, -1); }); Assert.Catch <LxException>(() => { list.Set(100, -1); }); SetTest(0, -1, count); SetTest(count / 2, -1, count); SetTest(count - 1, -1, count); }
private void SetTest(int setIndex, int setValue, int count) { LxList <int> list = InitList(count); list.Set(setIndex, setValue); for (int i = 0; i < list.Count; ++i) { int value = list.Get(i); if (i == setIndex) { Assert.AreEqual(setValue, value); } else { Assert.AreEqual(i, value); } } }