public async Task JsonCommand([Remainder] string input) { var entity = await _yugiohRepo.GetCardAsync(input); var json = JsonSerializer.Serialize(entity, new JsonSerializerOptions { WriteIndented = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }); Logger.Info(json); await ReplyAsync("Json printed to console"); }
public async Task GetJsonOfCard([Autocomplete(typeof(CardAutocomplete))] string input) { var entity = await _yugiohRepo.GetCardAsync(input); var json = JsonSerializer.Serialize(entity, new JsonSerializerOptions { WriteIndented = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }); Logger.Info(json); await File.WriteAllTextAsync("json.json", json); await RespondAsync("Json printed to console and written to file."); }
public async Task GetCardAsync_ExpectSuccess(string input, CardEntity expected) { var actual = await _yugiohRepo.GetCardAsync(input); AssertCardEntityEquality(expected, actual); }