public void AssignToEventNull() { Product mySuperProduct = ReflectionHelper.ActivateProduct(); var isChange = false; var isChanged = false; ReflectionHelper.AssignToEvent( null, (sender, args) => { isChanged = true; }, (sender, args) => { isChange = true; }); }
public void InvalidPriceSet() { Product mySuperProduct = ReflectionHelper.ActivateProduct(); var isChange = false; var isChanged = false; ReflectionHelper.AssignToEvent( mySuperProduct, (sender, args) => { isChanged = true; }, (sender, args) => { isChange = true; }); ReflectionHelper.RaiseEvent(mySuperProduct, -100); }
public void ReflectionCreateSignAndRaise() { Product mySuperProduct = ReflectionHelper.ActivateProduct(); var isChange = false; var isChanged = false; ReflectionHelper.AssignToEvent( mySuperProduct, (sender, args) => { isChanged = true; }, (sender, args) => { isChange = true; }); ReflectionHelper.RaiseEvent(mySuperProduct, 100); Assert.AreEqual(mySuperProduct.Price, 100); Assert.IsTrue(isChange); Assert.IsTrue(isChanged); }