public void TestMapNoArgumentCallback () { confirmationValue = INIT_VALUE; IEventBinding binding = new EventBinding (); binding.Bind (SomeEnum.ONE).To (noArgumentCallback); EventCallbackType type = binding.TypeForCallback (noArgumentCallback); object[] value = binding.value as object[]; Delegate extracted = value[0] as Delegate; Assert.AreEqual (EventCallbackType.NO_ARGUMENTS, type); extracted.DynamicInvoke(new object[0]); //Calling the method should change the confirmationValue Assert.AreNotEqual (confirmationValue, INIT_VALUE); }
public void TestMapOneArgumentCallback () { confirmationValue = INIT_VALUE; IEventBinding binding = new EventBinding (); binding.Bind (SomeEnum.ONE).To (oneArgumentCallback); EventCallbackType type = binding.TypeForCallback (oneArgumentCallback); object[] value = binding.value as object[]; Delegate extracted = value[0] as Delegate; Assert.AreEqual (EventCallbackType.ONE_ARGUMENT, type); object[] parameters = new object[1]; parameters [0] = new TestEvent("TEST", null, INIT_VALUE); extracted.DynamicInvoke(parameters); //Calling the method should change the confirmationValue Assert.AreEqual (confirmationValue, INIT_VALUE * INIT_VALUE); }