public void ChoicePromptReturnsCorrectIdForChoice()
        {
            TestChoicePromptHandler choicePromptHandler = new TestChoicePromptHandler();
            Task<int> promptTask =
                choicePromptHandler.PromptForChoice(
                    "Test prompt",
                    "Message is irrelevant",
                    Choices,
                    DefautlChoice);

            choicePromptHandler.HandleResponse("apple");

            Assert.Equal(TaskStatus.RanToCompletion, promptTask.Status);
            Assert.Equal(0, promptTask.Result);
            Assert.Equal(1, choicePromptHandler.TimesPrompted);
        }
        public void ChoicePromptReturnsCorrectIdForHotKey()
        {
            TestChoicePromptHandler choicePromptHandler = new TestChoicePromptHandler();
            Task<int> promptTask =
                choicePromptHandler.PromptForChoice(
                    "Test prompt",
                    "Message is irrelevant",
                    Choices,
                    DefautlChoice);

            // Try adding whitespace to ensure it works
            choicePromptHandler.HandleResponse(" N  ");

            Assert.Equal(TaskStatus.RanToCompletion, promptTask.Status);
            Assert.Equal(1, promptTask.Result);
            Assert.Equal(1, choicePromptHandler.TimesPrompted);
        }
        public void ChoicePromptReturnsCorrectIdForChoice()
        {
            TestChoicePromptHandler choicePromptHandler = new TestChoicePromptHandler();
            Task <int> promptTask =
                choicePromptHandler.PromptForChoice(
                    "Test prompt",
                    "Message is irrelevant",
                    Choices,
                    DefautlChoice,
                    CancellationToken.None);

            choicePromptHandler.HandleResponse("apple");

            Assert.Equal(TaskStatus.RanToCompletion, promptTask.Status);
            Assert.Equal(0, promptTask.Result);
            Assert.Equal(1, choicePromptHandler.TimesPrompted);
        }
        public void ChoicePromptRepromptsOnInvalidInput()
        {
            TestChoicePromptHandler choicePromptHandler = 
                new TestChoicePromptHandler();

            Task<int> promptTask =
                choicePromptHandler.PromptForChoice(
                    "Test prompt",
                    "Message is irrelevant",
                    Choices,
                    DefautlChoice);

            // Choice is invalid, should reprompt
            choicePromptHandler.HandleResponse("INVALID");

            Assert.Equal(TaskStatus.WaitingForActivation, promptTask.Status);
            Assert.Equal(2, choicePromptHandler.TimesPrompted);
        }
        public void ChoicePromptReturnsCorrectIdForHotKey()
        {
            TestChoicePromptHandler choicePromptHandler = new TestChoicePromptHandler();
            Task <int> promptTask =
                choicePromptHandler.PromptForChoice(
                    "Test prompt",
                    "Message is irrelevant",
                    Choices,
                    DefautlChoice,
                    CancellationToken.None);

            // Try adding whitespace to ensure it works
            choicePromptHandler.HandleResponse(" N  ");

            Assert.Equal(TaskStatus.RanToCompletion, promptTask.Status);
            Assert.Equal(1, promptTask.Result);
            Assert.Equal(1, choicePromptHandler.TimesPrompted);
        }
        public void ChoicePromptRepromptsOnInvalidInput()
        {
            TestChoicePromptHandler choicePromptHandler =
                new TestChoicePromptHandler();

            Task <int> promptTask =
                choicePromptHandler.PromptForChoice(
                    "Test prompt",
                    "Message is irrelevant",
                    Choices,
                    DefaultChoice,
                    CancellationToken.None);

            // Choice is invalid, should reprompt
            choicePromptHandler.ReturnInputString("INVALID");

            Assert.Equal(TaskStatus.WaitingForActivation, promptTask.Status);
            Assert.Equal(2, choicePromptHandler.TimesPrompted);
        }
        public void ChoicePromptReturnsCorrectIdForChoice()
        {
            TestChoicePromptHandler choicePromptHandler = new TestChoicePromptHandler();
            Task <int> promptTask =
                choicePromptHandler.PromptForChoice(
                    "Test prompt",
                    "Message is irrelevant",
                    Choices,
                    DefaultChoice,
                    CancellationToken.None);

            choicePromptHandler.ReturnInputString("apple");

            // Wait briefly for the prompt task to complete
            promptTask.Wait(1000);

            Assert.Equal(TaskStatus.RanToCompletion, promptTask.Status);
            Assert.Equal(0, promptTask.Result);
            Assert.Equal(1, choicePromptHandler.TimesPrompted);
        }