public void TestGetSet() { Listard <int> l = new Listard <int>(); int[] block = new int[] { 4711, 4712, 4713 }; l.Add(block); l[0] = 10 * l[0]; l.Set(10 * l.Get(1), 1); if (l[0] != 47110) { throw new Exception(); } if (l[1] != 47120) { throw new Exception(); } if (l.Get(2) != 4713) { throw new Exception(); } try { int test = l.Get(-1); throw new Exception(); } catch (IndexOutOfRangeException) { /* expected error */ } try { int test = l.Get(l.Count); throw new Exception(); } catch (IndexOutOfRangeException) { /* expected error */ } }
public void TestGetSet() { Listard <Position> l = new Listard <Position>(); Position[] block = new Position[] { new Position("47|11"), new Position("47|12"), new Position("48|13") }; l.Add(block); l[0].X = 10 * l[0].X; l.Set(new Position(l.Get(1).X, l.Get(1).Y * 10), 1); if (l[0].Text != "470|11") { throw new Exception(); } if (l[1].Text != "47|120") { throw new Exception(); } if (l.Get(2).Text != "48|13") { throw new Exception(); } try { Position test = l.Get(-1); throw new Exception(); } catch (IndexOutOfRangeException) { /* expected error */ } try { Position test = l.Get(l.Count); throw new Exception(); } catch (IndexOutOfRangeException) { /* expected error */ } }