public void EditableObjectModelBase_AddRemoveHandlerTest() { var fired = false; var person = new EditablePerson(); var listener = new Listener<PropertyChangedEventArgs>((sender, e) => { fired = true; }); person.ErrorsChanged += (sender, e) => { }; person.AddHandler(listener); person.FirstName = "Tom"; Assert.IsTrue(fired); fired = false; person.RemoveHandler(listener); person.FirstName = "Sam"; Assert.IsFalse(fired); }
public void EditableObjectModelBase_RemoveHandlerNullTest() { var person = new EditablePerson(); try { person.RemoveHandler(null); Assert.Fail("Excepted an ArgumentNullException"); } catch (ArgumentNullException ex) { Assert.AreEqual("eventHandler", ex.ParamName); } }