コード例 #1
0
        public void Execute_ExceptionThrowingCommand_ReturnsFalse()
        {
            var logdirector = new Mock<ILogger>();
            var executecommand = new Mock<IExecuteCommand>();
            executecommand.Setup(foo => foo.Execute(string.Empty, IntPtr.Zero, IntPtr.Zero)).Throws(new Exception("Test Exception"));

            var objectUnderTest = new ExecuteCommandOnCollection(logdirector.Object);
            objectUnderTest.Commands.Add(executecommand.Object);

            Assert.IsFalse(objectUnderTest.Execute(string.Empty, IntPtr.Zero, IntPtr.Zero));
        }
コード例 #2
0
        public void Execute_ExceptionThrowingCommand_LogsError()
        {
            var logdirector = new Mock<ILogger>();
            logdirector.Setup(foo => foo.Error(It.IsRegex("Exception in Execute")));
            var executecommand = new Mock<IExecuteCommand>();
            executecommand.Setup(foo => foo.Execute(string.Empty, IntPtr.Zero, IntPtr.Zero)).Throws(new Exception("Test Exception"));

            var objectUnderTest = new ExecuteCommandOnCollection(logdirector.Object);
            objectUnderTest.Commands.Add(executecommand.Object);
            objectUnderTest.Execute(string.Empty, IntPtr.Zero, IntPtr.Zero);

            logdirector.VerifyAll();
        }
コード例 #3
0
 public DefaultLoader(RunCommandOnCollection runCommand,
     ExecuteCommandOnCollection executeCommand,
     ExecuteBackgroundCommandOnCollection executeBackgroundCommand,
     ReloadCommandOnCollection reloadCommand,
     AssemblyResolver resolver,
     DefaultModuleDirectorySupervisor directorySupervisor,
     ILoggerContainer logger)
 {
     this.logger = logger;
     this.directorySupervisor = directorySupervisor;
     this.resolver = resolver;
     this.reloadCommand = reloadCommand;
     this.executeBackgroundCommand = executeBackgroundCommand;
     this.executeCommand = executeCommand;
     this.runCommand = runCommand;
 }
コード例 #4
0
        public void Execute_MultipleCommands_RunsAll()
        {
            var logdirector = new Mock<ILogger>();
            var executecommand1 = new Mock<IExecuteCommand>();
            executecommand1.Setup(foo => foo.Execute(string.Empty, IntPtr.Zero, IntPtr.Zero)).Returns(true);
            var executecommand2 = new Mock<IExecuteCommand>();
            executecommand2.Setup(foo => foo.Execute(string.Empty, IntPtr.Zero, IntPtr.Zero)).Returns(true);

            var objectUnderTest = new ExecuteCommandOnCollection(logdirector.Object);
            objectUnderTest.Commands.Add(executecommand1.Object);
            objectUnderTest.Commands.Add(executecommand2.Object);

            Assert.IsTrue(objectUnderTest.Execute(string.Empty, IntPtr.Zero, IntPtr.Zero));
            executecommand1.VerifyAll();
            executecommand2.VerifyAll();
        }
コード例 #5
0
 public void Execute_Empty_ReturnsTrue()
 {
     var logdirector = new Mock<ILogger>();
     var objectUnderTest = new ExecuteCommandOnCollection(logdirector.Object);
     Assert.IsTrue(objectUnderTest.Execute(string.Empty, IntPtr.Zero, IntPtr.Zero));
 }
コード例 #6
0
 public void ClassContainsCommandsCollection()
 {
     var logdirector = new Mock<ILogger>();
     var objectUnderTest = new ExecuteCommandOnCollection(logdirector.Object);
     Assert.IsNotNull(objectUnderTest.Commands);
 }