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

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