private static async Task <int> MoveRight(LazyOmdbList movieList, int currentIndex)
        {
            if (movieList.HasNext())
            {
                currentIndex += 1;
                await movieList.MoveNext();
            }

            return(currentIndex);
        }
        public async Task SearchWithTextFeature(string search, List <OmdbItem> expected)
        {
            LazyOmdbList omdbList = await this._client.SearchByTitleAsync(search);

            List <OmdbItem> resultList = new() { omdbList.CurrentItem() };

            while (omdbList.HasNext())
            {
                await omdbList.MoveNext();

                resultList.Add(omdbList.CurrentItem());
            }
            Assert.IsTrue(resultList.SequenceEqual(expected));
        }
        private async Task <OmdbMovie?> SelectMovieWithPaginatedEmbed(LazyOmdbList movieList, CommandContext context)
        {
            List <(OmdbMovie, DiscordEmbedBuilder)> omdbMovies = new();
            int currentIndex = 0;

            await context.RespondAsync(SELECT_MOVIE_TEXT);

            DiscordMessage msg = await context.Channel.SendMessageAsync($"{DiscordEmoji.FromGuildEmote(context.Client, 848012958851399710)} {Formatter.Bold(context.Guild.CurrentMember.DisplayName)} is getting your search results");

            _ = Task.Run(AddPaginationEmojis(msg));

            InteractivityExtension interactivity = context.Client.GetInteractivity();
            bool selected = false;

            do
            {
                if (currentIndex == omdbMovies.Count)
                {
                    try
                    {
                        OmdbMovie newMovie = await this.omdbClient.GetByImdbIdAsync(movieList.CurrentItem().ImdbId, omdbPlotOption : OmdbPlotOption.SHORT);

                        omdbMovies.Add((newMovie, newMovie.ToDiscordEmbedBuilder()));
                    }
                    catch (JsonException e)
                    {
                        await this.bot.LogExceptions(e);

                        if (movieList.HasNext())
                        {
                            await movieList.MoveNext();

                            continue;
                        }
                        else
                        {
                            currentIndex -= 1;
                        }
                    }
                }

                await msg.ModifyAsync(content: string.Empty, embed : omdbMovies[currentIndex].Item2.Build());

                InteractivityResult <MessageReactionAddEventArgs> waitForReactionResult = await interactivity.WaitForReactionAsync(this.ReactionIsPaginationEmoji, msg, context.Member);

                if (waitForReactionResult.TimedOut)
                {
                    await context.RespondAsync("You idled for too long and this search has been cancelled.");

                    return(null);
                }

                await waitForReactionResult.Result.Message.DeleteReactionAsync(waitForReactionResult.Result.Emoji, context.Member);

                switch (waitForReactionResult.Result.Emoji.Name)
                {
                case "⏪":
                    currentIndex = 0;
                    break;

                case "⬅️":
                    currentIndex = await MoveLeft(movieList, currentIndex);

                    break;

                case "✅":
                    selected = true;
                    break;

                case "➡️":
                    currentIndex = await MoveRight(movieList, currentIndex);

                    break;

                case "⏹️":
                    await context.RespondAsync("Stopping the search.");

                    return(null);

                default:
                    await SendInvalidSelectionMessage(context);

                    break;
                }
            }while (!selected);

            return(omdbMovies[currentIndex].Item1);
        }