示例#1
0
        /// <summary>
        /// Execute the action in the Given context
        /// </summary>
        /// <param name="command"></param>
        /// <typeparam name="TResult">The type returned by the action. Use the <see cref="Unit"/> to represent void actions</typeparam>
        public TResult Given <TResult>(IGivenCommand <TResult> command)
        {
            Guard.ForNull(command, nameof(command));
            var actor         = CreateGivenActor();
            var commandAction = command.AsAction();

            return(actor.Execute(commandAction));
        }
示例#2
0
        /// <summary>
        /// Execute the action in the Given context
        /// </summary>
        /// <param name="command"></param>
        /// <typeparam name="TResult">The type returned by the action. Use the <see cref="Unit"/> to represent void actions</typeparam>
        public TResult Given <TResult>(IGivenCommand <TResult> command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            var actor         = CreateGivenActor();
            var commandAction = command.AsAction();

            return(actor.Execute(commandAction));
        }