Example #1
0
    public void AddStrikeAsync()
    {
        var mock = new Mock <IStrikeData>(MockBehavior.Strict);

        mock.Setup(x => x.AddStrikeAsync(1, 2, 3, "reason", "date")).Returns(Task.CompletedTask);
        var guildService = new StrikeService(mock.Object);

        guildService.AddStrikeAsync(1, 2, 3, "reason", "date");

        mock.Verify(x => x.AddStrikeAsync(1, 2, 3, "reason", "date"), Times.Exactly(1));
    }
Example #2
0
    public async Task StrikeAdd(SocketUser user = null, string reason = "unspecified")
    {
        if (user == null)
        {
            await ReplyAsync("User not specified");

            return;
        }

        await Context.Message.DeleteAsync();

        await _strikesHandler.AddStrikeAsync(Context.Guild.Id, user.Id, Context.User.Id, reason, DateTime.Today.ToString("d"));

        await ShowStrikes(user);
    }