public void ShouldPassParametersCorrectly() { IDelegateReference actionDelegateReference = new MockDelegateReference() { Target = (Action <object>)(arg1 => { return; }) }; IDelegateReference filterDelegateReference = new MockDelegateReference { Target = (Predicate <object>)(arg => true) }; var mockDispatcher = new MockDispatcher(); DispatcherEventSubscription <object> eventSubscription = new DispatcherEventSubscription <object>(actionDelegateReference, filterDelegateReference, mockDispatcher); var executionStrategy = eventSubscription.GetExecutionStrategy(); Assert.IsNotNull(executionStrategy); object argument1 = new object(); executionStrategy.Invoke(new[] { argument1 }); Assert.AreSame(argument1, mockDispatcher.InvokeArg); }
public void ShouldPassParametersCorrectly() { IDelegateReference actionDelegateReference = new MockDelegateReference() { Target = (Action<object>)(arg1 => { return; }) }; IDelegateReference filterDelegateReference = new MockDelegateReference { Target = (Predicate<object>)(arg => true) }; var mockDispatcher = new MockDispatcher(); DispatcherEventSubscription<object> eventSubscription = new DispatcherEventSubscription<object>(actionDelegateReference, filterDelegateReference, mockDispatcher); var executionStrategy = eventSubscription.GetExecutionStrategy(); Assert.IsNotNull(executionStrategy); object argument1 = new object(); executionStrategy.Invoke(new[] { argument1 }); Assert.AreSame(argument1, mockDispatcher.InvokeArg); }
public void ShouldCallInvokeOnDispatcher() { DispatcherEventSubscription<object> eventSubscription = null; IDelegateReference actionDelegateReference = new MockDelegateReference() { Target = (Action<object>)(arg => { return; }) }; IDelegateReference filterDelegateReference = new MockDelegateReference { Target = (Predicate<object>)(arg => true) }; var mockDispatcher = new MockDispatcher(); eventSubscription = new DispatcherEventSubscription<object>(actionDelegateReference, filterDelegateReference, mockDispatcher); eventSubscription.GetExecutionStrategy().Invoke(new object[0]); Assert.IsTrue(mockDispatcher.InvokeCalled); }
public void ShouldCallInvokeOnDispatcher() { DispatcherEventSubscription <object> eventSubscription = null; IDelegateReference actionDelegateReference = new MockDelegateReference() { Target = (Action <object>)(arg => { return; }) }; IDelegateReference filterDelegateReference = new MockDelegateReference { Target = (Predicate <object>)(arg => true) }; var mockDispatcher = new MockDispatcher(); eventSubscription = new DispatcherEventSubscription <object>(actionDelegateReference, filterDelegateReference, mockDispatcher); eventSubscription.GetExecutionStrategy().Invoke(new object[0]); Assert.IsTrue(mockDispatcher.InvokeCalled); }