public void Should_Serialize_Request_Poll_Keyboard_Button(string type) { IReplyMarkup replyMarkup = new ReplyKeyboardMarkup( KeyboardButton.WithRequestPoll("Create a poll", type) ); string serializedReplyMarkup = JsonSerializer.Serialize(replyMarkup, new JsonSerializerOptions(JsonSerializerDefaults.Web)); string formattedType = string.IsNullOrEmpty(type) ? "{}" : $@"{{""type"":""{type}""}}"; string expectedString = $@"""request_poll"":{formattedType}"; Assert.Contains(expectedString, serializedReplyMarkup); }
public void Should_Serialize_Request_Poll_Keyboard_Button(string type) { IReplyMarkup replyMarkup = new ReplyKeyboardMarkup( KeyboardButton.WithRequestPoll("Create a poll", type) ); string serializedReplyMarkup = JsonConvert.SerializeObject(replyMarkup); string formattedType = string.IsNullOrEmpty(type) ? "{}" : string.Format(@"{{""type"":""{0}""}}", type); string expectedString = string.Format(@"""request_poll"":{0}", formattedType); Assert.Contains(expectedString, serializedReplyMarkup); }