public virtual void TestEmptyMap() { ObjectIdOwnerMap <ObjectIdOwnerMapTest.SubId> m = new ObjectIdOwnerMap <ObjectIdOwnerMapTest.SubId >(); NUnit.Framework.Assert.IsTrue(m.IsEmpty()); NUnit.Framework.Assert.AreEqual(0, m.Size()); Iterator <ObjectIdOwnerMapTest.SubId> i = m.Iterator(); NUnit.Framework.Assert.IsNotNull(i); NUnit.Framework.Assert.IsFalse(i.HasNext()); NUnit.Framework.Assert.IsFalse(m.Contains(Id(1))); }
public virtual void TestIterator() { ObjectIdOwnerMap <ObjectIdOwnerMapTest.SubId> m = new ObjectIdOwnerMap <ObjectIdOwnerMapTest.SubId >(); m.Add(id_1); m.Add(id_2); m.Add(id_3); Iterator <ObjectIdOwnerMapTest.SubId> i = m.Iterator(); NUnit.Framework.Assert.IsTrue(i.HasNext()); NUnit.Framework.Assert.AreSame(id_1, i.Next()); NUnit.Framework.Assert.IsTrue(i.HasNext()); NUnit.Framework.Assert.AreSame(id_2, i.Next()); NUnit.Framework.Assert.IsTrue(i.HasNext()); NUnit.Framework.Assert.AreSame(id_3, i.Next()); NUnit.Framework.Assert.IsFalse(i.HasNext()); try { i.Next(); NUnit.Framework.Assert.Fail("did not fail on next with no next"); } catch (NoSuchElementException) { } // OK i = m.Iterator(); NUnit.Framework.Assert.AreSame(id_1, i.Next()); try { i.Remove(); NUnit.Framework.Assert.Fail("did not fail on remove"); } catch (NotSupportedException) { } }