public virtual void TestAddToEmptyList() { RefList <Ref> one = ToList(); RefList <Ref> two = one.Add(0, REF_B); NUnit.Framework.Assert.AreNotSame(one, two); // one is not modified, but two is NUnit.Framework.Assert.AreEqual(0, one.Size()); NUnit.Framework.Assert.AreEqual(1, two.Size()); NUnit.Framework.Assert.IsFalse(two.IsEmpty()); NUnit.Framework.Assert.AreSame(REF_B, two.Get(0)); }
public virtual void TestEmpty() { RefList <Ref> list = RefList.EmptyList(); NUnit.Framework.Assert.AreEqual(0, list.Size()); NUnit.Framework.Assert.IsTrue(list.IsEmpty()); NUnit.Framework.Assert.IsFalse(list.Iterator().HasNext()); NUnit.Framework.Assert.AreEqual(-1, list.Find("a")); NUnit.Framework.Assert.AreEqual(-1, list.Find("z")); NUnit.Framework.Assert.IsFalse(list.Contains("a")); NUnit.Framework.Assert.IsNull(list.Get("a")); try { list.Get(0); NUnit.Framework.Assert.Fail("RefList.emptyList should have 0 element array"); } catch (IndexOutOfRangeException) { } }