Esempio n. 1
0
        public async Task BCRPFindCmdOK()
        {
            var cmd       = new Cmd();
            var cmd2      = new Cmd2();
            var processor = new CommandRequestProcessorTest(new List <ICommand> {
                cmd, cmd2
            });
            var request = new BaseCommandBotRequest <JToken>(null, cmd.UniqueName,
                                                             JToken.FromObject(new DiscussCommandBotRequest()), null, null, BotCommandContext.DiscussPostForm);
            await processor.ProcessAsync(request);

            Assert.IsTrue(cmd.DiscussCmdExecuted);
            Assert.IsFalse(cmd.EventCmdExecuted);
            Assert.IsFalse(cmd.MesCmdExecuted);
            cmd.DiscussCmdExecuted = false;

            request.ctx = BotCommandContext.EventPostForm;
            await processor.ProcessAsync(request);

            Assert.IsFalse(cmd.DiscussCmdExecuted);
            Assert.IsTrue(cmd.EventCmdExecuted);
            Assert.IsFalse(cmd.MesCmdExecuted);
            cmd.EventCmdExecuted = false;

            request.ctx = BotCommandContext.MessagingPostForm;
            await processor.ProcessAsync(request);

            Assert.IsFalse(cmd.DiscussCmdExecuted);
            Assert.IsFalse(cmd.EventCmdExecuted);
            Assert.IsTrue(cmd.MesCmdExecuted);
        }
 public HttpResponseMessage GetCarsForCmd2(string foo, int bar, [FromUri] Cmd2 cmd)
 {
     return(new HttpResponseMessage(HttpStatusCode.OK)
     {
         Content = new StringContent("Default Car for Cmd2")
     });
 }
Esempio n. 3
0
        public async Task BCRPNotFoundCtxCmdFail()
        {
            var cmd       = new Cmd();
            var cmd2      = new Cmd2();
            var processor = new CommandRequestProcessorTest(new List <ICommand> {
                cmd, cmd2
            });
            var response = await processor.ProcessAsync(new BaseCommandBotRequest <JToken>(null, cmd.UniqueName,
                                                                                           JToken.FromObject(new DiscussCommandBotRequest()), null, null, (BotCommandContext)5));

            CheckFailResponse(response);
        }
Esempio n. 4
0
 int Foo2(Cmd2 cmd)
 {
     return(cmd());
 }
Esempio n. 5
0
	int Foo2 (Cmd2 cmd)
	{
		return cmd ();
	}