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); }
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); }
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); }