コード例 #1
0
        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);
        }
コード例 #2
0
 public IAssertInvocations ForEventAdd <TTarget, THandler>(TTarget target, string eventName, THandler handler)
 {
     return(Assert(InvocationMatcher.ForEventAdd(target, eventName, handler)));
 }
コード例 #3
0
 public void ForEventAddOnNonExistingEvent()
 {
     Assert.Throws <ArgumentException>(() => InvocationMatcher.ForEventAdd(myObject, "Event2", Any <EventHandler> .Value));
 }
コード例 #4
0
 public ISpecifyAction EventAdd <TTarget, THandler>(TTarget target, string eventName, THandler handler)
 {
     return(ActionInvoked(InvocationMatcher.ForEventAdd(target, eventName, handler)));
 }