public void Add() { var list = new CoordinateList <int>(); var c = new Coordinate <int>(13, 14); list.Add(c); Assert.AreEqual(1, list.Count); list.Add(23, 24); Assert.AreEqual(2, list.Count); }
public void Equals() { var list1 = new CoordinateList <int>(); var list2 = new CoordinateList <int>(); var c = new Coordinate <int>(13, 14); list1.Add(c); Assert.IsFalse(list1.Equals(list2)); list2.Add(c); Assert.IsTrue(list1.Equals(list2)); }
public void ToArray() { var list = new CoordinateList <int>(); var c = new Coordinate <int>(13, 14); int[] array = list.ToArray(); Assert.IsNull(array); list.Add(c); array = list.ToArray(); Assert.AreEqual(2, array.Length); }
public void ForEach() { var list = new CoordinateList <int>(); for (int i = 0; i < 10; i++) { list.Add(new Coordinate <int>(i, 2 * i)); } int count = 0; list.ForEach(c => { Assert.IsTrue(c == new Coordinate <int>(count, 2 * count)); count++; }); Assert.AreEqual(list.Count, count); }
public void Enumerator() { var list = new CoordinateList <int>(); for (int i = 0; i < 10; i++) { list.Add(new Coordinate <int>(i, 2 * i)); } int count = 0; foreach (var c in list) { Assert.IsTrue(c == new Coordinate <int>(count, 2 * count)); count++; } Assert.AreEqual(list.Count, count); }