示例#1
0
    public void SetPrefixAsync()
    {
        var mock = new Mock <IGuildData>(MockBehavior.Strict);

        mock.Setup(x => x.SetPrefixAsync(1, '-')).Returns(Task.FromResult(testConfig));
        var guildService = new GuildService(mock.Object);

        guildService.SetPrefixAsync(1, '-');

        mock.Verify(x => x.SetPrefixAsync(1, '-'), Times.Exactly(1));
    }
示例#2
0
    public async Task SetPrefix(char?prefix = null)
    {
        if (prefix == null)
        {
            await ReplyAsync("No prefix specified");

            return;
        }
        await _guildService.SetPrefixAsync(Context.Guild.Id, (char)prefix);

        await ReplyAsync($"prefix set to {prefix}");
    }