public virtual void TestIterator() { IdentitySet4 set = new IdentitySet4(); object o1 = new object(); object o2 = new object(); set.Add(o1); set.Add(o2); Iterator4Assert.SameContent(Iterators.Iterate(new object[] { o1, o2 }), set.GetEnumerator ()); }
private void CommitParticipants() { if (ParentLocalTransaction() != null) { ParentLocalTransaction().CommitParticipants(); } IEnumerator iterator = _participants.GetEnumerator(); while (iterator.MoveNext()) { ((ITransactionParticipant)iterator.Current).Commit(this); } }
public virtual void NotifyListeners(object @event) { if (_listeners == null) { return; } var i = _listeners.GetEnumerator(); while (i.MoveNext()) { ((IListener4)i.Current).OnEvent(@event); } }
public virtual void TestByIdentity() { IdentitySet4 table = new IdentitySet4(2); IdentitySet4TestCase.Item item1 = new IdentitySet4TestCase.Item(1); Assert.IsFalse(table.Contains(item1)); table.Add(item1); Assert.IsTrue(table.Contains(item1)); IdentitySet4TestCase.Item item2 = new IdentitySet4TestCase.Item(2); Assert.IsFalse(table.Contains(item2)); table.Add(item2); Assert.IsTrue(table.Contains(item2)); Assert.AreEqual(2, table.Size()); int size = 0; IEnumerator i = table.GetEnumerator(); while (i.MoveNext()) { size++; } Assert.AreEqual(2, size); }