Ejemplo n.º 1
0
 public void ExecuteStartTwoProcessesWithSameInstanceWithoutReset_ThrowException()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile   = testConsoleExe.TestConsoleExeFile;
         var target    = new Library.Module.Common.Process.Process(_logger);
         var arguments = "WriteVersionToStdOut";
         target.Execute(exeFile, arguments, true, null);
         Assert.Throws <NMultiToolException>(() =>
         {
             target.Execute(exeFile, arguments, true, null);
         });
         var expected = "Version 1.0.0.1" + Environment.NewLine;
         var actual   = target.StandardOutput;
         Assert.AreEqual(expected, actual);
     }
 }
Ejemplo n.º 2
0
 public void ExecuteWait5SecondsAndExitTest()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile = testConsoleExe.TestConsoleExeFile;
         var target = new Library.Module.Common.Process.Process(_logger);
         var arguments = "Wait5SecondsAndExit";
         target.Execute(exeFile, arguments, true, null);
         var expected = "Waiting....."+ Environment.NewLine + "Done waiting!" + Environment.NewLine;
         var actual = target.StandardOutput;
         Assert.AreEqual(expected, actual,"StandardOutput not expected.");
     }
 }
Ejemplo n.º 3
0
 public void ExecuteStdOutTest()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile = testConsoleExe.TestConsoleExeFile;
         var target = new Library.Module.Common.Process.Process(_logger);
         var arguments = "WriteVersionToStdOut";
         target.Execute(exeFile, arguments, true, null);
         var expected = "Version 1.0.0.1" + Environment.NewLine;
         var actual = target.StandardOutput;
         Assert.AreEqual(expected, actual);
     }
 }
Ejemplo n.º 4
0
 public void ExecuteWait5SecondsAndExitTest()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile   = testConsoleExe.TestConsoleExeFile;
         var target    = new Library.Module.Common.Process.Process(_logger);
         var arguments = "Wait5SecondsAndExit";
         target.Execute(exeFile, arguments, true, null);
         var expected = "Waiting....." + Environment.NewLine + "Done waiting!" + Environment.NewLine;
         var actual   = target.StandardOutput;
         Assert.AreEqual(expected, actual, "StandardOutput not expected.");
     }
 }
Ejemplo n.º 5
0
 public void ExecuteStdOutTest()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile   = testConsoleExe.TestConsoleExeFile;
         var target    = new Library.Module.Common.Process.Process(_logger);
         var arguments = "WriteVersionToStdOut";
         target.Execute(exeFile, arguments, true, null);
         var expected = "Version 1.0.0.1" + Environment.NewLine;
         var actual   = target.StandardOutput;
         Assert.AreEqual(expected, actual);
     }
 }
Ejemplo n.º 6
0
 public void ExecuteStdErrTest()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile = testConsoleExe.TestConsoleExeFile;
         var target = new Library.Module.Common.Process.Process(_logger);
         var arguments = "WriteErrorToStdErrAndReturnOne";
         target.Execute(exeFile, arguments, true, null);
         var expected = "ERROR: Simulated error 1!" + Environment.NewLine + "ERROR: Simulated error 2!" + Environment.NewLine;
         var actual = target.StandardError;
         Assert.AreEqual(expected, actual, "StandardError not expected.");
         int actualExitCode = target.ExitCode;
         int expectedExitCode = 1;
         Assert.AreEqual(expectedExitCode, actualExitCode, "Exit code not expected.");
     }
 }
Ejemplo n.º 7
0
 public void ExecuteStdErrTest()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile   = testConsoleExe.TestConsoleExeFile;
         var target    = new Library.Module.Common.Process.Process(_logger);
         var arguments = "WriteErrorToStdErrAndReturnOne";
         target.Execute(exeFile, arguments, true, null);
         var expected = "ERROR: Simulated error 1!" + Environment.NewLine + "ERROR: Simulated error 2!" + Environment.NewLine;
         var actual   = target.StandardError;
         Assert.AreEqual(expected, actual, "StandardError not expected.");
         int actualExitCode   = target.ExitCode;
         int expectedExitCode = 1;
         Assert.AreEqual(expectedExitCode, actualExitCode, "Exit code not expected.");
     }
 }
Ejemplo n.º 8
0
 public void ExecuteStdInputAskForPassowordGiveCorrectPassword()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile = testConsoleExe.TestConsoleExeFile;
         var target = new Library.Module.Common.Process.Process(_logger);
         var arguments = "AskForPassword";
         target.WriteToStandardInput("secret");
         target.Execute(exeFile, arguments, true, null);
         var expected = "Write 'secret' password: (stdout)" + Environment.NewLine + "Password: "******"Password is correct (stdout)" + Environment.NewLine;
         var actual = target.StandardOutput;
         Assert.AreEqual(expected, actual, "StandardOutput not expected while asking for password.");
         int actualExitCode = target.ExitCode;
         int expectedExitCode = 0;
         Assert.AreEqual(expectedExitCode, actualExitCode, "Exit code not expected.");
     }
 }
Ejemplo n.º 9
0
 public void ExecuteStdInputAskForPassowordGiveCorrectPassword()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile   = testConsoleExe.TestConsoleExeFile;
         var target    = new Library.Module.Common.Process.Process(_logger);
         var arguments = "AskForPassword";
         target.WriteToStandardInput("secret");
         target.Execute(exeFile, arguments, true, null);
         var expected = "Write 'secret' password: (stdout)" + Environment.NewLine + "Password: "******"Password is correct (stdout)" + Environment.NewLine;
         var actual   = target.StandardOutput;
         Assert.AreEqual(expected, actual, "StandardOutput not expected while asking for password.");
         int actualExitCode   = target.ExitCode;
         int expectedExitCode = 0;
         Assert.AreEqual(expectedExitCode, actualExitCode, "Exit code not expected.");
     }
 }
Ejemplo n.º 10
0
 public void ExecuteStartTwoProcessesWithSameInstanceWithoutReset_ThrowException()
 {
     using (var testConsoleExe = new TestConsoleExe())
     {
         var exeFile = testConsoleExe.TestConsoleExeFile;
         var target = new Library.Module.Common.Process.Process(_logger);
         var arguments = "WriteVersionToStdOut";
         target.Execute(exeFile, arguments, true, null);
         Assert.Throws<NMultiToolException>(() =>
         {
             target.Execute(exeFile, arguments, true, null);
         });
         var expected = "Version 1.0.0.1" + Environment.NewLine;
         var actual = target.StandardOutput;
         Assert.AreEqual(expected, actual);                
     }
 }