public void ReturnFour_WhenCallingAScriptThatReturnFour() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("RunPowershellScript.CustAct")); var finalResult = Tools.GetReturnCodeAction(); finalResult.ReturnMethod = global::CustomUpdateEngine.ReturnCodeAction.ReturnCodeMethod.Variable; // Act action.Run(ref finalResult); // Assert Assert.AreEqual(4, finalResult.ReturnValue); }
public void ProperlyInitializeProperties_WhenCalled() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("RunPowershellScript.CustAct")); // Act // Assert Assert.AreEqual(action.FullPath, @"C:\Users\Courtel\Documents\Visual Studio 2013\Projects\Wsus Package Publisher2\Unit Tests-CustomeUpdateEngine\Templates for Unit Tests\PowershellReturnCode.ps1"); Assert.IsTrue(action.KillProcess); Assert.AreEqual(action.Parameters, "4 arg1 arg2 \"arg3 With space\""); Assert.IsTrue(action.StoreToVariable); Assert.AreEqual(action.DelayBeforeKilling, 10); }
public void KillProcess_WhenTakingTooMuchTime() { // Arrange SUT action = new SUT(Tools.GetXmlFragment("RunPowershellAndWaitAndKill.CustAct")); var finalResult = Tools.GetReturnCodeAction(); finalResult.ReturnMethod = global::CustomUpdateEngine.ReturnCodeAction.ReturnCodeMethod.Variable; System.Diagnostics.Stopwatch chrono = new System.Diagnostics.Stopwatch(); // Act chrono.Start(); action.Run(ref finalResult); chrono.Stop(); // Assert Assert.AreEqual(60.0, chrono.Elapsed.TotalSeconds, 2); Assert.AreEqual(-1, finalResult.ReturnValue); }