public void Test_Remove_ObjectDoesNotExist() { var list = new BeatObjectList <BPM>(); var bpm = new BPM(100, 0); Assert.IsFalse(list.Remove(bpm)); }
public void Test_Remove_ObjectExists() { var list = new BeatObjectList <BPM>(); var bpm = new BPM(100, 0); list.Add(bpm); Assert.IsTrue(list.Remove(bpm)); Assert.AreEqual(0, list.Count); }
public void Test_Remove_FiresRemovedEvent() { var list = new BeatObjectList <BPM>(); var removedList = new List <BPM>(); var bpm = new BPM(100, 0); list.Add(bpm); list.Removed += (o, e) => { var args = e as ObjectListEventArgs <BPM>; removedList.Add(args.Object); }; list.Remove(new BPM(100, 0)); // Verify the event doesn't fire when an equivalent but different object is removed. Assert.IsEmpty(removedList); list.Remove(bpm); Assert.AreEqual(1, removedList.Count); Assert.AreSame(bpm, removedList[0]); }
public void Test_Remove_CantBeNull() { var list = new BeatObjectList <BPM>(); Assert.Throws <ArgumentNullException>(() => list.Remove(null)); }