Пример #1
0
        public async Task MessageWithNoPrefixIsIgnored()
        {
            var botConfig = CreateBotConfigWithPrefix("MyPrefix");
            var input     = CreateInputWithMessage("Message without a prefix");
            var nextStep  = new Mock <ICommandPipelineStep>();
            var step      = new PreconditionCheckStep(nextStep.Object, botConfig);

            await step.ProcessAsync(input);

            AssertNextStepIsNotCalled(nextStep);
        }
Пример #2
0
        public async Task NoPrefixSetIgnoreAllMessages()
        {
            const uint ExpectedPrefixOffset = 0;
            var        botConfig            = CreateBotConfigWithNoPrefix();
            var        input    = CreateInputWithMessage("Any Message");
            var        nextStep = new Mock <ICommandPipelineStep>();
            var        step     = new PreconditionCheckStep(nextStep.Object, botConfig);

            await step.ProcessAsync(input);

            AssertNextStepIsCalled(nextStep);
            Assert.Equal(ExpectedPrefixOffset, input.PrefixOffset);
        }
Пример #3
0
        public async Task MessageWithPrefixCallsNextStep()
        {
            const uint ExpectedPrefixOffset = 8;
            var        botConfig            = CreateBotConfigWithPrefix("MyPrefix");
            var        input    = CreateInputWithMessage("MyPrefix Message with a prefix");
            var        nextStep = new Mock <ICommandPipelineStep>();
            var        step     = new PreconditionCheckStep(nextStep.Object, botConfig);

            await step.ProcessAsync(input);

            AssertNextStepIsCalled(nextStep);
            Assert.Equal(ExpectedPrefixOffset, input.PrefixOffset);
        }