Exemple #1
0
        private void SetUpApplyInput()
        {
            var methodInfo = typeof(TestingCommandImplementor).GetMethod(nameof(TestingCommandImplementor.ApplyInput));

            methodCallValidatorServiceMock
            .ValidateMethodCallExpressionAndReturnMethodInfo <TestingCommandImplementor,
                                                              CommandMethodFactoryProvider.ICommandDelegateMethodSignatures>(
                x => x.ApplyInput(null, null),
                y => y.ApplyInput(null, null)).ReturnsForAnyArgs(methodInfo);
        }
Exemple #2
0
        public Action <ICommandContext, string> CreateApplyInputActionForInputCommand <TCommand>(
            Expression <Action <TCommand> > applyInputExpression,
            TCommand instance)
            where TCommand : class
        {
            var method =
                methodValidator
                .ValidateMethodCallExpressionAndReturnMethodInfo <TCommand, ICommandDelegateMethodSignatures>(
                    applyInputExpression,
                    x => x.ApplyInput(null, null));

            return((context, input) =>
            {
                var target = instance ?? context.GetService <TCommand>();
                method.Invoke(target, new object[] { context, input });
            });
        }