public void Execute_Action1ChangesPassedReferenceArgument_DoesChangeArgumentPassedToAction2() { var refActions = new CompositeAction <ReferenceType>(); const int originalIdentity = 0; const int newIdentity = 1; ReferenceType passedToAction2 = null; Action <ReferenceType> action1 = refArg => refArg.Identity = newIdentity; Action <ReferenceType> action2 = refArg => passedToAction2 = refArg; refActions .RegisterAction(action1) .RegisterAction(action2) .Invoke(new ReferenceType(originalIdentity)); Assert.That(passedToAction2.Identity, Is.EqualTo(newIdentity)); }
public void Register_Null_Throws() { const Action <int> nullAction = null; Assert.Throws <ArgumentNullException>(() => _actions.RegisterAction(nullAction)); }