Adding test for ArrayPromptDialog
This commit is contained in:
parent
3817d01836
commit
f99c8ef14c
27
TelegramBotBase.Test/Tests/ArrayPromptDialogTest.cs
Normal file
27
TelegramBotBase.Test/Tests/ArrayPromptDialogTest.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TelegramBotBase.Form;
|
||||
|
||||
namespace TelegramBotBase.Example.Tests
|
||||
{
|
||||
public class ArrayPromptDialogTest : ArrayPromptDialog
|
||||
{
|
||||
|
||||
public ArrayPromptDialogTest() : base("Choose an option", new[] { new ButtonBase("Option 1", "option1"), new ButtonBase("Option 2", "option2") })
|
||||
{
|
||||
|
||||
this.ButtonClicked += ArrayPromptDialogTest_ButtonClicked;
|
||||
}
|
||||
|
||||
private void ArrayPromptDialogTest_ButtonClicked(object sender, Args.ButtonClickedEventArgs e)
|
||||
{
|
||||
|
||||
Console.WriteLine(e.Button.Text + " has been clicked");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Threading.Tasks;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using TelegramBotBase.Base;
|
||||
using TelegramBotBase.Enums;
|
||||
@ -215,6 +216,14 @@ public class Menu : AutoCleanForm
|
||||
|
||||
break;
|
||||
|
||||
case "arraypromptdialog":
|
||||
|
||||
var apt = new ArrayPromptDialogTest();
|
||||
|
||||
await NavigateTo(apt);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
message.Handled = false;
|
||||
@ -271,6 +280,8 @@ public class Menu : AutoCleanForm
|
||||
|
||||
btn.AddButtonRow(new ButtonBase("#20 Label", new CallbackData("a", "label").Serialize()));
|
||||
|
||||
btn.AddButtonRow(new ButtonBase("#21 ArrayPromptDialogTest", new CallbackData("a", "arraypromptdialog").Serialize()));
|
||||
|
||||
await Device.Send("Choose your test:", btn);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user