public void IfCanRunCommandWithNoOutputAndEventRunFinishedIsRaised()
 {
     var runSync = new RunAsync();
     var result = 0;
     var waitHandle = new AutoResetEvent(false);
     runSync.RunFinished += () =>
         {
             result = 1;
             waitHandle.Set();
         };
     runSync.Run("write");
     waitHandle.ThrowIfHandleTimesOut(TimeSpan.FromSeconds(5));
     Assert.AreEqual(1, result);
 }
        public void IfCanRunCommandAndReturnOutput()
        {
            var runAsync = new RunAsync();
            var result = "";
            var waitHandle = new AutoResetEvent(false);
            runAsync.OutputChanged += (x) =>
                {
                    result = x;
                    waitHandle.Set();
                };
            runAsync.Run("write test");

            waitHandle.ThrowIfHandleTimesOut(TimeSpan.FromSeconds(5));

            Assert.AreEqual("test\r\n", result);
        }
 public void IfCanRunCommand()
 {
     var runAsync = new RunAsync();
     runAsync.Run("write test");
 }
 public void IfCanRunWrongCommandWithNoOutputAndEventOutputChangedIsRaised()
 {
     var runSync = new RunAsync();
     var result = "";
     var waitHandle = new AutoResetEvent(false);
     runSync.OutputChanged += (x) =>
     {
         result = x;
         waitHandle.Set();
     };
     runSync.Run("thingdingding");
     waitHandle.ThrowIfHandleTimesOut(TimeSpan.FromSeconds(5));
     Assert.AreEqual("No output", result);
 }