public void ForEventAdd()
        {
            var invocationMatcher = InvocationMatcher.ForEventAdd(myObject, "Event", Any <EventHandler> .Value);

            Assert.AreSame(myObject, invocationMatcher.Target);
            Assert.AreEqual(typeof(IMyObject).GetEvent("Event").GetAddMethod(), invocationMatcher.Method);
            CollectionAssert.AreEqual(new object[] { Any <EventHandler> .Value }, invocationMatcher.ParameterValueConstraints);
        }
Exemplo n.º 2
0
 public IAssertInvocations ForEventAdd <TTarget, THandler>(TTarget target, string eventName, THandler handler)
 {
     return(Assert(InvocationMatcher.ForEventAdd(target, eventName, handler)));
 }
 public void ForEventAddOnNonExistingEvent()
 {
     Assert.Throws <ArgumentException>(() => InvocationMatcher.ForEventAdd(myObject, "Event2", Any <EventHandler> .Value));
 }
Exemplo n.º 4
0
 public ISpecifyAction EventAdd <TTarget, THandler>(TTarget target, string eventName, THandler handler)
 {
     return(ActionInvoked(InvocationMatcher.ForEventAdd(target, eventName, handler)));
 }