Ejemplo n.º 1
0
        public void DefaultPowerShellShouldBe2IfInstalled()
        {
            IMock mockRegistry2 = new DynamicMock(typeof(IRegistry));

            PowerShellTask task = new PowerShellTask((IRegistry)mockRegistry2.MockInstance, (ProcessExecutor)mockProcessExecutor.MockInstance);
            mockRegistry2.ExpectAndReturn("GetLocalMachineSubKeyValue", POWERSHELL2_PATH,
                                        PowerShellTask.regkeypowershell2,PowerShellTask.regkeyholder);
            Assert.AreEqual(POWERSHELL2_PATH + "\\powershell.exe", task.Executable);
            mockRegistry2.Verify();
            mockProcessExecutor.Verify();
        }
 public void ToStringReturnsTheBaseDirectoryAndExe()
 {
     var task = new PowerShellTask
     {
         ConfiguredScriptsDirectory = "testDir"
     };
     var actual = task.ToString();
     var expected = " BaseDirectory: testDir, PowerShell: powershell.exe";
     Assert.AreEqual(expected, actual);
 }
 public void SuccessExitCodesHandlesEmpty()
 {
     var task = new PowerShellTask();
     task.SuccessExitCodes = string.Empty;
     Assert.AreEqual(string.Empty, task.SuccessExitCodes);
 }
 public void SuccessExitCodesIsSuccessfullySplitAndRebuilt()
 {
     var task = new PowerShellTask();
     task.SuccessExitCodes = "1,2,3";
     Assert.AreEqual("1,2,3", task.SuccessExitCodes);
 }
 public void Setup()
 {
     mockRegistry = new DynamicMock(typeof(IRegistry));
     CreateProcessExecutorMock(POWERSHELL1_PATH);
     mytask = new PowerShellTask((IRegistry)mockRegistry.MockInstance, (ProcessExecutor)mockProcessExecutor.MockInstance);
 }