public void UintTest_Add() { List <string> events = new List <string>(); IPersonCollection persons = new PersonCollection(); persons.ListChanging += (o, e) => { events.Add(e.ListChangedType.ToString()); }; persons.ListChanged += (o, e) => { events.Add(e.ListChangedType.ToString()); }; persons.Add(new PersonItem("Homer", "Simpons")); Assert.AreEqual(ListChangingType.ItemAdding.ToString(), events[0]); Assert.AreEqual(ListChangedType.ItemAdded.ToString(), events[1]); }
public void _0002_CastItemToEnumerable() { IPersonCollection pc = new PersonCollection(); pc.Add(new PersonItem("Simpson", "Homer")); pc.Add(new PersonItem("Simpson", "Bart")); IEnumerable <IPersonItem> x; x = new List <IPersonItem>(); foreach (var item in x) { } pc.Cast <IPersonItem>().FirstOrDefault(n => n.First == "Simpson"); }