public void ExecuteShouldInvokeCallback() { // arrange var dataItem = new object(); var execute = new Mock<Action<object, object>>(); execute.Setup( f => f( It.IsAny<object>(), It.IsAny<object>() ) ); var command = new DataItemCommand<object, object>( execute.Object, dataItem ); // act command.Execute(); // assert execute.Verify( f => f( dataItem, null ), Times.Once() ); }
public void CanExecuteShouldInvokeCallback() { // arrange var dataItem = new object(); var canExecute = new Mock<Func<object, object, bool>>(); canExecute.Setup( f => f( It.IsAny<object>(), It.IsAny<object>() ) ).Returns( true ); var command = new DataItemCommand<object, object>( DefaultAction.None, canExecute.Object, dataItem ); // act command.CanExecute(); // assert canExecute.Verify( f => f( dataItem, null ), Times.Once() ); }