public void TestCanExecuteWithoutExecutor() { CommandInfo ci = new CommandInfo(); bool canExec = ci.CanExecute(); Assert.IsFalse(canExec); }
public async Task HelpAsync([Remainder] CommandInfo commandName) { if (!commandName.CanExecute(Context, _provider)) { await ReplyAsync("You do not have permission to run this command.").ConfigureAwait(false); } else { await ReplyAsync("", embed: commandName.GetEmbed(Context)).ConfigureAwait(false); } }
public void TestCanExecute() { Mock<ICommand> testCommand = new Mock<ICommand>(); testCommand.Setup(c => c.CanExecute()).Returns(true); CommandInfo ci = new CommandInfo(); ci.Executor(testCommand.Object); bool canExec = ci.CanExecute(); Assert.IsTrue(canExec); testCommand.Verify(c => c.CanExecute(), Times.Once()); }
public void TestCanExecute() { Mock <ICommand> testCommand = new Mock <ICommand>(); testCommand.Setup(c => c.CanExecute()).Returns(true); CommandInfo ci = new CommandInfo(); ci.Executor(testCommand.Object); bool canExec = ci.CanExecute(); Assert.IsTrue(canExec); testCommand.Verify(c => c.CanExecute(), Times.Once()); }