public async Task DecimalNumberPrompt()
        {
            ConversationState convoState = new ConversationState(new MemoryStorage());
            var testProperty             = convoState.CreateProperty <Dictionary <string, object> >("test");

            TestAdapter adapter = new TestAdapter()
                                  .Use(convoState);

            await new TestFlow(adapter, async(turnContext, cancellationToken) =>
            {
                var state  = await testProperty.GetAsync(turnContext, () => new Dictionary <string, object>());
                var prompt = new NumberPrompt <decimal>(Culture.English);

                var dialogCompletion = await prompt.ContinueAsync(turnContext, state);
                if (!dialogCompletion.IsActive && !dialogCompletion.IsCompleted)
                {
                    await prompt.BeginAsync(turnContext, state, new PromptOptions {
                        PromptString = "Enter a number."
                    });
                }
                else if (dialogCompletion.IsCompleted)
                {
                    var numberResult = (NumberResult <decimal>)dialogCompletion.Result;
                    await turnContext.SendActivityAsync($"Bot received the number '{numberResult.Value}'.");
                }
            })
            .Send("hello")
            .AssertReply("Enter a number.")
            .Send("3.14")
            .AssertReply("Bot received the number '3.14'.")
            .StartTestAsync();
        }
        public async Task NumberPromptValidator()
        {
            ConversationState convoState = new ConversationState(new MemoryStorage());
            var testProperty             = convoState.CreateProperty <Dictionary <string, object> >("test");

            TestAdapter adapter = new TestAdapter()
                                  .Use(convoState);


            PromptValidator <NumberResult <int> > validator = async(ctx, result) =>
            {
                if (result.Value < 0)
                {
                    result.Status = PromptStatus.TooSmall;
                }
                if (result.Value > 100)
                {
                    result.Status = PromptStatus.TooBig;
                }
                await Task.CompletedTask;
            };

            await new TestFlow(adapter, async(turnContext, cancellationToken) =>
            {
                var state  = await testProperty.GetAsync(turnContext, () => new Dictionary <string, object>());
                var prompt = new NumberPrompt <int>(Culture.English, validator);

                var dialogCompletion = await prompt.ContinueAsync(turnContext, state);
                if (!dialogCompletion.IsActive && !dialogCompletion.IsCompleted)
                {
                    await prompt.BeginAsync(turnContext, state,
                                            new PromptOptions
                    {
                        PromptString      = "Enter a number.",
                        RetryPromptString = "You must enter a positive number less than 100."
                    });
                }
                else if (dialogCompletion.IsCompleted)
                {
                    var numberResult = (NumberResult <int>)dialogCompletion.Result;
                    await turnContext.SendActivityAsync($"Bot received the number '{numberResult.Value}'.");
                }
            })
            .Send("hello")
            .AssertReply("Enter a number.")
            .Send("150")
            .AssertReply("You must enter a positive number less than 100.")
            .Send("64")
            .AssertReply("Bot received the number '64'.")
            .StartTestAsync();
        }
        public async Task NumberPrompt()
        {
            var activities = TranscriptUtilities.GetFromTestContext(TestContext);


            PromptValidatorEx.PromptValidator <NumberResult <int> > validator = async(ctx, result) =>
            {
                if (result.Value < 0)
                {
                    result.Status = PromptStatus.TooSmall;
                }
                if (result.Value > 100)
                {
                    result.Status = PromptStatus.TooBig;
                }
                await Task.CompletedTask;
            };

            var convState    = new ConversationState(new MemoryStorage());
            var testProperty = convState.CreateProperty <Dictionary <string, object> >("test", () => new Dictionary <string, object>());

            TestAdapter adapter = new TestAdapter()
                                  .Use(convState);

            await new TestFlow(adapter, async(turnContext) =>
            {
                if (turnContext.Activity.Type == ActivityTypes.Message)
                {
                    var state  = await testProperty.GetAsync(turnContext);
                    var prompt = new NumberPrompt <int>(Culture.English, validator);

                    var dialogCompletion = await prompt.ContinueAsync(turnContext, state);
                    if (!dialogCompletion.IsActive && !dialogCompletion.IsCompleted)
                    {
                        await prompt.BeginAsync(turnContext, state,
                                                new PromptOptions
                        {
                            PromptString      = "Enter a number.",
                            RetryPromptString = "You must enter a valid positive number less than 100."
                        });
                    }
                    else if (dialogCompletion.IsCompleted)
                    {
                        var numberResult = (NumberResult <int>)dialogCompletion.Result;
                        await turnContext.SendActivityAsync($"Bot received the number '{numberResult.Value}'.");
                    }
                }
            })
            .Test(activities)
            .StartTestAsync();
        }