public void KeyboardButtonActionTypeTest() { // get test Assert.That(actual: KeyboardButtonActionType.Text.ToString(), expression: Is.EqualTo(expected: "text")); // parse test Assert.That(actual: KeyboardButtonActionType.FromJsonString(response: "text"), expression: Is.EqualTo(expected: KeyboardButtonActionType.Text)); }
public void KeyboardButtonActionTypeTest() { // get test Assert.That(KeyboardButtonActionType.Text.ToString(), Is.EqualTo("text")); // parse test Assert.That(KeyboardButtonActionType.FromJsonString("text"), Is.EqualTo(KeyboardButtonActionType.Text)); }
public KeyboardBuilder AddButton(string text, string command, List <string> arguments = null, bool reqContact = false, bool reqLocation = false, KeyboardButtonColor color = default, KeyboardButtonActionType type = null, string btnHash = null, ulong?btnAppId = null, ulong?btnOwnerId = null) { if (command != null) { try { var pb = new PayloadBuilder(command, arguments); _bot.AliasesCommand.Add(text, pb.BuildToModel()); }catch (Exception) { //Console.WriteLine($"Алиас {text} уже существует."); } } AddButton(new NucleusKeyboardButton() { Caption = text ?? "my button", RequestContact = reqContact, RequestLocation = reqLocation, Color = color, Type = type ?? KeyboardButtonActionType.Text, Payload = command != null ? new PayloadBuilder(command, arguments).BuildToModel(): null, Hash = btnHash ?? null, AppID = btnAppId ?? 0, OwnerID = btnOwnerId ?? 0 }); return(this); }