public void Should_Accept_Handling_All(string text, string commandValue)
        {
            const string botUsername = "******";
            var          mockBot     = new Mock <IBot>();

            mockBot.SetupGet(x => x.UserName)
            .Returns(botUsername);

            var update = new Update
            {
                Message = new Message
                {
                    Text     = text,
                    Entities = new List <MessageEntity>
                    {
                        new MessageEntity
                        {
                            Type   = MessageEntityType.BotCommand,
                            Offset = text.IndexOf(commandValue, StringComparison.OrdinalIgnoreCase),
                            Length = commandValue.Length
                        },
                    },
                },
            };
            var sut = new TestCommand("Test");

            var actual = sut.CanHandleUpdate(mockBot.Object, update);

            Assert.True(actual);
        }
        public void Should_Refuse_Handling_Non_Message_Updates()
        {
            const string botUsername = "******";
            var          mockBot     = new Mock <IBot>();

            mockBot.SetupGet(x => x.UserName)
            .Returns(botUsername);

            var update = new Update
            {
                CallbackQuery = new CallbackQuery()
            };
            IUpdateHandler sut = new TestCommand("Test");

            var actual = sut.CanHandleUpdate(mockBot.Object, update);

            Assert.False(actual);
        }
        public void Should_Refuse_Handling_Text_Messages(string text)
        {
            const string botUsername = "******";
            var          mockBot     = new Mock <IBot>();

            mockBot.SetupGet(x => x.UserName)
            .Returns(botUsername);

            var update = new Update
            {
                Message = new Message
                {
                    Text = text,
                },
            };
            var sut = new TestCommand("Test");

            var actual = sut.CanHandleUpdate(mockBot.Object, update);

            Assert.False(actual);
        }