Beispiel #1
0
        public void Should_send_a_text_message_successfully()
        {
            BaleClient client = new BaleClient(Token);

            client.SendTextMessage(new TextMessage()
            {
                ChatId = ChatId,
                Text   = "salam"
            });
        }
Beispiel #2
0
        public void Send_message_should_fail_because_token_is_invalid()
        {
            BaleClient client   = new BaleClient("invalid token");
            Response   response = client.SendTextMessage(new TextMessage()
            {
                ChatId = ChatId,
                Text   = "good by world!",
            });

            response.Ok.Should().BeFalse();
            response.Errorcode.Should().Be(401);
        }
Beispiel #3
0
        public void Send_a_textMessage_with_inlineKeyboard_via_keboard_builder()
        {
            BaleClient client   = new BaleClient(Token);
            Response   response = client.SendTextMessage(new TextMessage()
            {
                ChatId      = ChatId,
                Text        = "click on buttons",
                ReplyMarkup = ReplyKeyboard.Create().AddButton("button one").AddButton("button two")
                              .AddButton("button three").Build()
            });

            response.Ok.Should().BeTrue();
            response.Result.Should().NotBeNull();
        }
Beispiel #4
0
        public void DeleteMessage_successfully()
        {
            BaleClient client   = new BaleClient(Token);
            Response   response = client.SendTextMessage(new TextMessage()
            {
                ChatId = ChatId,
                Text   = "should be deleted very soon :)"
            });


            Response <bool> deleteMessageResponse = client.DeleteMessage(ChatId, response.Result.MessageId);


            deleteMessageResponse.Ok.Should().BeTrue();
        }
Beispiel #5
0
        public void Update_message_successfully()
        {
            BaleClient client   = new BaleClient(Token);
            Response   response = client.SendTextMessage(new TextMessage()
            {
                ChatId = ChatId,
                Text   = "salam"
            });


            Response editResponse = client.EditTextMessage(new TextMessage()
            {
                ChatId = ChatId,
                Text   = "updated text message"
            }, response.Result.MessageId);


            editResponse.Ok.Should().BeTrue();
            editResponse.Description.Should().BeNull();
        }
Beispiel #6
0
        public void Send_a_textMessage_with_inlineKeyboard()
        {
            BaleClient client   = new BaleClient(Token);
            Response   response = client.SendTextMessage(new TextMessage()
            {
                ChatId      = ChatId,
                Text        = "click on buttons",
                ReplyMarkup = new ReplyKeyboard()
                {
                    InlineKeyboard = new List <List <InlineKeyboardItem> >()
                    {
                        new List <InlineKeyboardItem>()
                        {
                            new InlineKeyboardItem("button one"),
                            new InlineKeyboardItem("button two")
                        }
                    }
                }
            });

            response.Ok.Should().BeTrue();
            response.Result.Should().NotBeNull();
        }