当前位置: 首页>>代码示例>>C#>>正文


C# CommandProcessor类代码示例

本文整理汇总了C#中CommandProcessor的典型用法代码示例。如果您正苦于以下问题:C# CommandProcessor类的具体用法?C# CommandProcessor怎么用?C# CommandProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommandProcessor类属于命名空间,在下文中一共展示了CommandProcessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterCommands

        private static void RegisterCommands(Container container)
        {
            var eventDelegator = new EventBus();
            var eventStore = new EventStore(eventDelegator);
            var aggregateFactory = new AggregateFactory();
            var commandProcessor = new CommandProcessor(aggregateFactory, eventStore);

            container.RegisterSingleton<IProcessCommands>(() => commandProcessor);
        }
开发者ID:mikkeldamm,项目名称:cqrs-es-ddd,代码行数:9,代码来源:Global.asax.cs

示例2: CancelCommandGroup_CancelAGroup_AllCommandsInGroupAreCancelled

        public void CancelCommandGroup_CancelAGroup_AllCommandsInGroupAreCancelled()
        {
            int[] commandsCanceled = {0};
            var fakeFilterManager = A.Fake<IFilterManager>();
            A.CallTo(() => fakeFilterManager.Process(A<CommandBase>.Ignored)).Returns(false);

            var processor = new CommandProcessor(null, fakeFilterManager);
            var commands = new[]
                           {
                               new TestCommand(CommandState.New, groupId: "GroupA"),
                               new TestCommand(CommandState.New, groupId: "GroupB"),
                               new TestCommand(CommandState.New, groupId: "GroupA"),
                               new TestCommand(CommandState.New, groupId: "GroupA"),
                               new TestCommand(CommandState.New, groupId: "GroupB"),
                               new TestCommand(CommandState.New, groupId: "GroupA"),
                               new TestCommand(CommandState.New, groupId: "GroupC"),

                           };
            foreach (var command in commands)
            {
                command.RegisterForStateChange(Observer.Create<CommandState>(b =>
                {
                    if (b == CommandState.Canceled)
                    {
                        commandsCanceled[0]++;
                    }
                }));

                processor.PublishCommand(command);
            }

            processor.CancelCommandGroup("GroupA");

            Assert.AreEqual(4, commandsCanceled[0]);
        }
开发者ID:arielbh,项目名称:CodeCommander,代码行数:35,代码来源:CommandProcessorTests.cs

示例3: start_the_application

 public start_the_application(IBackgroundThread thread, ILoadPresentationModulesCommand command,
                              CommandProcessor processor)
 {
     this.thread = thread;
     this.command = command;
     this.processor = processor;
 }
开发者ID:mokhan,项目名称:mo.money,代码行数:7,代码来源:start_the_application.cs

示例4: ExecuteQuery

 private static void ExecuteQuery(CommandProcessor commandProcessor)
 {
     Console.WriteLine("Executing query");
     var query = new SayHelloQuery("Dan");
     commandProcessor.Execute(query).Wait();
     Console.WriteLine(query.Result);
 }
开发者ID:DannyRyman,项目名称:CommandProcessor,代码行数:7,代码来源:Program.cs

示例5: SetUp

        public void SetUp()
        {
            repository = new Mock<Repository>();
              next = new Mock<Processor<Event>>();

              sut = new CommandProcessor(repository.Object, next.Object);
        }
开发者ID:njmube,项目名称:public,代码行数:7,代码来源:CommandProcessorTests.cs

示例6: BuildRunner

        public static IRunner BuildRunner(Action<IConfigurationHelper> configurator)
        {
            var configPlan = new ConfigurationPlan();

            if (configurator != null)
            {
                configurator(configPlan);
            }

            configPlan.Validate();

            var routingInfo = GetRoutingInfo(configPlan);

            routingInfo.Validate();

            var router = new CommandRouter(routingInfo);

            var argsHelper = new ArgsHelper(configPlan.SwitchDelimiter);
            var argsHelpProvider = new ArgsParameterHelpProvider(argsHelper);
            var argsParameterBinder = new ArgsParameterBinder(argsHelper);

            var helpProvider = new HelpProvider(router, argsHelpProvider);
            var cmdProcessor = new CommandProcessor(router, configPlan.TypeInstantiationStrategy, argsParameterBinder);

            return new RunnerInternal(helpProvider, cmdProcessor);
        }
开发者ID:bnwasteland,项目名称:thorn,代码行数:26,代码来源:Builder.cs

示例7: Main

        public static void Main()
        {
            // we can create a singleton instance of the command processor. each execution can occur concurrently
            // and has it's own state.
            var processorSingleton = new CommandProcessor(DemoAPICommandProcessorConfiguration.Instance);

            // command with return value - 1 transaction per command
            int id = processorSingleton.Execute(new AddProductModel()
            {
                // ... properties ...
            });

            // command with no return value - 1 transaction per command
            processorSingleton.Execute(new SetProductModelName()
            {
                // ... properties ...
            });

            processorSingleton.Execute(new AddProductReview()
            {
                ProductId = 316,

                ReviewerName = "Joseph Daigle",
                EmailAddress = "[email protected]",
                Rating = 4,
                Comments = "Meh",
            });
        }
开发者ID:jdaigle,项目名称:CQRSPipelineDemo,代码行数:28,代码来源:Program.cs

示例8: SesService

		public SesService(CommandProcessor processor)
		{
			if (processor == null)
			{
				throw new ArgumentNullException("processor");
			}
			_processor = processor;
		}
开发者ID:adamjmoon,项目名称:AwsSesWrapper.Net,代码行数:8,代码来源:IAwsSesService.cs

示例9: SupportsQueryCommand

 public void SupportsQueryCommand()
 {
     HomeState state = new HomeState();
     state.CreateFurniture("sofa","room",new DateTime(2015,12,01));
     Mock<TextWriter> writerMock = new Mock<TextWriter>();
     CommandProcessor processor = new CommandProcessor(state, writerMock.Object);
     string command = "query -date 01.12.2015";
     processor.Process(command);
     writerMock.Verify(w=>w.WriteLine(It.IsAny<string>()));
 }
开发者ID:drypa,项目名称:FurnitureInRoom,代码行数:10,代码来源:CommandProcessorTest.cs

示例10: TestProcessCommand

        static void TestProcessCommand()
        {
            SubscriptionClient subscriptionClient = SubscriptionClient.CreateFromConnectionString( serviceBusConnectionString, commandTopicPath, commandHandlerSubscription );
            SubscriptionReceiver receiver = new SubscriptionReceiver( subscriptionClient );
            ITextSerializer serializer = new JsonTextSerializer();

            CommandProcessor orderCommandProcessor = new CommandProcessor( receiver, serializer );
            orderCommandProcessor.Register( new OrderCommandHandler() );

            orderCommandProcessor.Start();
        }
开发者ID:nghiaminhle,项目名称:ddd-cqrs-cqrs-es,代码行数:11,代码来源:Program.cs

示例11: ExecuteWithNullCommandThrowsArgumentNullException

        public void ExecuteWithNullCommandThrowsArgumentNullException()
        {
            var serviceProviderMock = new Mock<IServiceProvider>(MockBehavior.Strict);

            var sut = new CommandProcessor(serviceProviderMock.Object);

            TestCommand command = null;

            var ex = Assert.Throws<ArgumentNullException>(() => sut.Execute(command));

            Assert.Equal("command", ex.ParamName);
        }
开发者ID:Georadix,项目名称:Georadix.NET,代码行数:12,代码来源:CommandProcessorFixture.cs

示例12: Main

 public static void Main()
 {
     // TODO: Add instance of the GameRenderingEngine and call that instance when creating the game engine
     var brightSkin = new BrightSkin();
     IOInterface userInterractor = new ConsoleInterface(brightSkin);
     Scoreboard scoreboard = Scoreboard.GetInstance;
     scoreboard.SetIOInterface(userInterractor);
     GameBoard gameBoard = GameBoard.GetInstance;
     CommandProcessor commandProcessor = new CommandProcessor(gameBoard, scoreboard, userInterractor, new CommandParser());
     GameEngine engine = new GameEngine(commandProcessor, userInterractor, gameBoard);
     engine.Play();
 }
开发者ID:RadoChervenkov,项目名称:Minesweeper,代码行数:12,代码来源:Minesweeper.cs

示例13: SetUp

        public static void SetUp()
        {
            container = new TinyInversionOfControlContainer(new TinyIoCContainer());

            commandProcessor = new CommandProcessor(container);
            container.Register<IAmAUnitOfWorkFactory, UnitOfWorkFactory>().AsSingleton();
            container.Register<IRepository<Meeting, MeetingDocument>, Repository<Meeting, MeetingDocument>>().AsMultiInstance();
            container.Register<IIssueTickets, TicketIssuer>().AsMultiInstance();
            container.Register<IScheduler, Scheduler>();
            container.Register<IAmAnOverbookingPolicy, FiftyPercentOverbookingPolicy>();
            container.Register<IIssueTickets, TicketIssuer>();
            container.Register<IHandleRequests<ScheduleMeetingCommand>, ScheduleMeetingCommandHandler>("ScheduleMeetingCommandHandler");
        }
开发者ID:johnnonolan,项目名称:Paramore,代码行数:13,代码来源:ScheduleAMeetingSteps.cs

示例14: VerifyTest

		public void VerifyTest()
		{
			var cmd = new VerifyEmailAddressCommand
			          	{
			          		EmailAddress = Helper.GetSenderEmailAddress()
			          	};


			var cp = new CommandProcessor(_builder);

			var resp = cp.Process(cmd, _parser);


			Console.WriteLine(resp.Command + " : ID " +  resp.RequestID);
		}
开发者ID:adamjmoon,项目名称:AwsSesWrapper.Net,代码行数:15,代码来源:VerifyEmailAddressCommandTests.cs

示例15: SupportsRemoveRoomCommand

        public void SupportsRemoveRoomCommand()
        {
            Mock<IHomeState> stateMock = new Mock<IHomeState>();
            CommandProcessor processor = new CommandProcessor(stateMock.Object, Console.Out);
            string command = "remove-room -date 12.01.2015 -room Bedroom -transfer dining";
            processor.Process(command);
            stateMock.Verify(a => a.RemoveRoom("Bedroom", "dining", new DateTime(2015, 01, 12)));

            command = "remove-room -room Bedroom -date 12.01.2015";
            processor.Process(command);
            stateMock.Verify(a => a.RemoveRoom("Bedroom","dining",new DateTime(2015, 01, 12)));

            command = "remove-room -room Bedroom -transfer dining";
            processor.Process(command);
            stateMock.Verify(a => a.RemoveRoom("Bedroom", "dining", It.IsAny<DateTime>()));
        }
开发者ID:drypa,项目名称:FurnitureInRoom,代码行数:16,代码来源:CommandProcessorTest.cs


注:本文中的CommandProcessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。