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


C# CommandProcessor.Process方法代码示例

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


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

示例1: 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

示例2: SupprotsCreateFurnitureCommand

        public void SupprotsCreateFurnitureCommand()
        {
            Mock<IHomeState> stateMock = new Mock<IHomeState>();
            CommandProcessor processor = new CommandProcessor(stateMock.Object, Console.Out);
            string command = "create-furniture -date 12.01.2015 -room Bedroom -type sofa";
            processor.Process(command);
            stateMock.Verify(a => a.CreateFurniture("sofa", "Bedroom", new DateTime(2015, 01, 12)));

            command = "create-furniture -room Bedroom -date 12.01.2015 -type sofa";
            processor.Process(command);
            stateMock.Verify(a => a.CreateFurniture("sofa", "Bedroom", new DateTime(2015, 01, 12)));

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

示例3: 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

示例4: 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

示例5: Run

		public void Run()
		{
			var cmd = new DeleteVerifiedEmailAddressCommand
			          	{
			          		EmailAddress = _email
			          	};


			

			var cp = new CommandProcessor(_builder);

			var resp = cp.Process(cmd, new DeleteVerifiedEmailAddressResponseParser());

			Console.WriteLine(resp.Command + " : ID " + resp.RequestID);

		}
开发者ID:adamjmoon,项目名称:AwsSesWrapper.Net,代码行数:17,代码来源:DeleteVerifiedEmailAddressCommandTests.cs

示例6: T1

		public void T1()
		{
			var cmd = new SendRawEmailCommand
			{
				Source = Helper.GetSenderEmailAddress(),

				RawData = Convert.ToBase64String(RawEmailGenerator.SendRawEmail(Encoding.ASCII, Helper.GetSenderEmailAddress(), Helper.GetRecipientEmailAddress(), "test email subject", "this is some text",
			             "<p>this is some html</p><p>asdasd asdasd</p>"))
			};


			cmd.Destination.ToAddresses.Add(Helper.GetRecipientEmailAddress());
//            cmd.RawData =
//                @"From: [email protected]
//To: [email protected]
//Subject: testing SES
//MIME-Version: 1.0
//Content-Type: multipart/alternative; 
//	boundary=""----=_Part_286008_14012783.1304034624483""
//Date: Thu, 28 Apr 2011 23:50:24 +0000
//Message-ID: <[email protected]il.amazonses.com>
//
//------=_Part_286008_14012783.1304034624483
//Content-Type: text/plain; charset=UTF-8
//Content-Transfer-Encoding: 7bit
//
//this is not bold text
//------=_Part_286008_14012783.1304034624483
//Content-Type: text/html; charset=UTF-8
//Content-Transfer-Encoding: 7bit
//
//<b>this is bold text</b>
//------=_Part_286008_14012783.1304034624483--
//";

			Console.WriteLine(cmd.RawData);

			var cp = new CommandProcessor(_builder);

			var resp = cp.Process(cmd, new SendRawEmailCommandResponseParser());


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

示例7: Main

        static void Main(string[] args)
        {
            try {
                System.Console.WriteLine(WELCOME_MESSAGE);
                System.Console.WriteLine(COMMAND_INIT_MESSAGE);

                IRobot robot = new Robot();
                ICommandProcessor commandProcessor = new CommandProcessor(robot);

                while (true)
                {
                    string output = commandProcessor.Process(System.Console.ReadLine());
                    if (output != "") {
                        System.Console.WriteLine(output);
                    }
                }
            }catch (Exception ex)
            {
                //TODO : Exception to be logged
                System.Console.WriteLine(UNKNOWN_ERROR);
            }
        }
开发者ID:shanmohan,项目名称:toy-robot,代码行数:22,代码来源:Program.cs

示例8: SendStatistics

		public void SendStatistics()
		{
			var cmd = new GetSendStatisticsCommand();


			HttpWebRequest request = _builder.Build(cmd);

			Helper.ProcessRequest(request);

			var cp = new CommandProcessor(_builder);

			var stats = cp.Process(cmd, new GetSendStatisticsResponseParser());

			foreach(var stat in stats.SendStatistics)
			{
				Console.WriteLine("DeliveryAttempts : " + stat.DeliveryAttempts);
				Console.WriteLine("Timestamp : " + stat.Timestamp);
				Console.WriteLine("Bounces : " + stat.Bounces);
				Console.WriteLine("Rejects : " + stat.Rejects);
				Console.WriteLine("Complaints : " + stat.Complaints);
			}
			
		}
开发者ID:adamjmoon,项目名称:AwsSesWrapper.Net,代码行数:23,代码来源:SendStatisticsTests.cs

示例9: ProcessShouldThrowCommandNotSupportedExceptionInCaseOfWrongCommand

 public void ProcessShouldThrowCommandNotSupportedExceptionInCaseOfWrongCommand()
 {
     CommandProcessor processor = new CommandProcessor(new HomeState(),Console.Out);
     processor.Process("wrong-command");
 }
开发者ID:drypa,项目名称:FurnitureInRoom,代码行数:5,代码来源:CommandProcessorTest.cs

示例10: GenerateEmail

		public void GenerateEmail()
		{
//            var data = RawEmailGenerator.SendRawEmail(this.Encoding, "[email protected]", "[email protected]"/*"[email protected]"*/, "test", @"this is some text
//xfgdfgjkdfg dfgkjdgf kdjfg dfgkjdfg kdfjhd fgkjdfg dfgkjhfdgkjdhfgkjdhfgk dfkjgdhf gkjdhfg sdfkjshdfkjshdfjhsdfjhsdfhjgsdf
//and a seconf line",
//                         @"<p>this is some html</p>
//xfgdfgjkdfg dfgkjdgf kdjfg dfgkjdfg kdfjhd fgkjdfg dfgkjhfdgkjdhfgkjdhfgk dfkjgdhf gkjdhfg sdfkjshdfkjshdfjhsdfjhsdfhjgsdf
//<p>asdasd asdasd</p>");


			var data = RawEmailGenerator.SendRawEmail(this.Encoding, "[email protected]", "[email protected]", "test", @"abc",
			 null);


			var email = ParseEmail(data);

			var sig = GenerateSignature(email, "From", "To", "Subject");

			var text = "DKIM-Signature: " + sig + Environment.NewLine + new StreamReader(new MemoryStream(data)).ReadToEnd();// Environment.NewLine + email.Headers + Environment.NewLine + email.Body;

			Console.WriteLine("---- start ----");
			Console.WriteLine(text);
			Console.WriteLine("---- end ----");

			var cmd = new SendRawEmailCommand
			{
				

				RawData = Convert.ToBase64String( this.Encoding.GetBytes(text) )
			};

			Console.WriteLine(cmd.RawData);

			var cp = new CommandProcessor(_builder);

			var resp = cp.Process(cmd, new SendRawEmailCommandResponseParser());


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

示例11: WillTimeoutEventuallyIfCannotSave

            public void WillTimeoutEventuallyIfCannotSave()
            {
                var command = new FakeCommand();
                var aggregate = new FakeAggregate();
                var envelope = new CommandEnvelope(GuidStrategy.NewGuid(), command);
                var message = Message.Create(GuidStrategy.NewGuid(), HeaderCollection.Empty, envelope);
                var processor = new CommandProcessor(HandlerRegistry.Object, TransientErrorRegistry.Object, new CommandProcessorSettings { RetryTimeout = TimeSpan.FromMilliseconds(20) });

                SystemTime.ClearOverride();

                AggregateStore.Setup(mock => mock.Get(typeof(FakeAggregate), envelope.AggregateId)).Returns(aggregate);
                AggregateStore.Setup(mock => mock.Save(aggregate, It.IsAny<CommandContext>())).Callback(() => { throw new ConcurrencyException(); });
                HandlerRegistry.Setup(mock => mock.GetHandlerFor(command)).Returns(new CommandHandler(typeof(FakeAggregate), typeof(FakeCommand), AggregateStore.Object, (a, c) => ((FakeAggregate)a).Handle((FakeCommand)c)));

                Assert.Throws<TimeoutException>(() => processor.Process(message));
            }
开发者ID:SparkSoftware,项目名称:infrastructure,代码行数:16,代码来源:CommandProcessorTests.cs


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