Ejemplo n.º 1
0
        private static async Task getGenresAsync(UserSession session)
        {
            await Bot.SendChatActionAsync(session.Message.Chat.Id, ChatAction.Typing);

            var genres = _moviesGlobalResCtl.GetMovieGenres();

            List <List <InlineKeyboardButton> > keyboardButtonsLines = new List <List <InlineKeyboardButton> >();

            for (int i = 0; i < genres.Count;)
            {
                List <InlineKeyboardButton> row = new List <InlineKeyboardButton>();
                for (int j = 0; j < 3 && i < genres.Count; ++j, ++i)
                {
                    row.Add(genres.ElementAt(i).Key);
                }
                keyboardButtonsLines.Add(row);
            }
            var inlineKeyboard = new InlineKeyboardMarkup(keyboardButtonsLines);


            await Bot.SendTextMessageAsync(
                session.Message.Chat.Id,
                "Choose",
                replyMarkup : inlineKeyboard);
        }
        public void TestGetMovieGenres()
        {
            var genres = _moviesGlobalResCtl.GetMovieGenres();

            Assert.AreNotEqual(genres.Count, 0);
        }