Exemple #1
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.");
     }
 }
Exemple #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.");
     }
 }
Exemple #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);
     }
 }
Exemple #4
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);
     }
 }
Exemple #5
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.");
     }
 }
Exemple #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.");
     }
 }
Exemple #7
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.");
     }
 }
Exemple #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.");
     }
 }
Exemple #9
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);
     }
 }
Exemple #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);                
     }
 }