示例#1
0
        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");
        }
示例#2
0
    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.");
    }
示例#3
0
    public async Task GetCardAsync_ExpectSuccess(string input, CardEntity expected)
    {
        var actual = await _yugiohRepo.GetCardAsync(input);

        AssertCardEntityEquality(expected, actual);
    }