Example #1
0
        public void TestCanExecuteWithoutExecutor()
        {
            CommandInfo ci      = new CommandInfo();
            bool        canExec = ci.CanExecute();

            Assert.IsFalse(canExec);
        }
Example #2
0
 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);
     }
 }
Example #3
0
      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());
      }
Example #4
0
        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());
        }
Example #5
0
 public void TestCanExecuteWithoutExecutor()
 {
    CommandInfo ci = new CommandInfo();
    bool canExec = ci.CanExecute();
    Assert.IsFalse(canExec);
 }