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

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