Esempio n. 1
0
        public void IssuesCommand(TrackedCommand command)
        {
            "Given I have a command"
            .Given(() =>
            {
                command = new TrackedCommand {
                    A = 1, B = 2
                };
            });

            "When the command is processed in the pipeline"
            .When(async() =>
            {
                await pipeline.Execute(command);
            });

            "Then the command handler should have been executed"
            .Then(() =>
            {
                TrackedCommandHandler.LastCommand.Should().BeSameAs(command);
            });
        }
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Processes the specified context.
        /// </summary>
        /// <param name="context">
        ///  The context.
        /// </param>
        /// <returns>
        ///  The ContinuationStatus.
        /// </returns>
        ///-------------------------------------------------------------------------------------------------
        public ContinuationStatus Process(ExecutionCommandContext <T> context)
        {
            DebugContract.Requires(context, "context");

            var pipe = new CommandPipeline(context, _handler);

            // Cette info est activée lors du chargement des metadonnées d'un domainModel.
            // Il n'est pas possible d'activer des rules sur les métadonnées.
            var skipRules = (Session.Current.Mode & SessionMode.SkipInterceptors) == SessionMode.SkipInterceptors;

            // Preconditions
            if (_interceptors != null && !skipRules)
            {
                pipe.Register(GetInterceptorsFor(context.CurrentSession, context.Command).ToList());
            }

            return(pipe.Execute());
        }
Esempio n. 3
0
 private Task ExecutePipeline <TCommand>(TCommand command)
 {
     return(pipeline.Execute(command));
 }
Esempio n. 4
0
 public Task Send <TCommand>(TCommand command)
 {
     return(pipeline.Execute(command));
 }