public void testAddToEmptyList() { RefList <global::GitSharp.Core.Ref> one = toList(); RefList <global::GitSharp.Core.Ref> two = one.add(0, REF_B); Assert.AreNotSame(one, two); // one is not modified, but two is Assert.AreEqual(0, one.size()); Assert.AreEqual(1, two.size()); Assert.IsFalse(two.isEmpty()); Assert.AreSame(REF_B, two.get(0)); }
public void testEmpty() { RefList <global::GitSharp.Core.Ref> list = RefList <global::GitSharp.Core.Ref> .emptyList(); Assert.AreEqual(0, list.size()); Assert.IsTrue(list.isEmpty()); Assert.IsFalse(list.iterator().hasNext()); Assert.AreEqual(-1, list.find("a")); Assert.AreEqual(-1, list.find("z")); Assert.IsFalse(list.contains("a")); Assert.IsNull(list.get("a")); try { list.get(0); Assert.Fail("RefList.emptyList should have 0 element array"); } catch (IndexOutOfRangeException) { // expected } }