if ((async_mode & AsyncModes.SyncOutput) != 0)
throw new InvalidOperationException ("Cannot mix asynchronous and synchonous reads.");
+ if ((async_mode & AsyncModes.AsyncOutput) != 0)
+ throw new InvalidOperationException ("An async read operation has already been started on the stream.");
+
async_mode |= AsyncModes.AsyncOutput;
if (async_output == null)
if ((async_mode & AsyncModes.SyncError) != 0)
throw new InvalidOperationException ("Cannot mix asynchronous and synchonous reads.");
+ if ((async_mode & AsyncModes.AsyncError) != 0)
+ throw new InvalidOperationException ("An async read operation has already been started on the stream.");
+
async_mode |= AsyncModes.AsyncError;
if (async_error == null)
Assert.IsTrue (found, sb.ToString ());
}
}
+
+ [Test]
+ [NUnit.Framework.Category ("MobileNotWorking")]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void TestDoubleBeginOutputReadLine ()
+ {
+ using (Process p = new Process ()) {
+ p.StartInfo = GetCrossPlatformStartInfo ();
+ p.StartInfo.UseShellExecute = false;
+ p.StartInfo.RedirectStandardOutput = true;
+ p.StartInfo.RedirectStandardError = true;
+
+ p.Start ();
+
+ p.BeginOutputReadLine ();
+ p.BeginOutputReadLine ();
+
+ Assert.Fail ();
+ }
+ }
+
+ [Test]
+ [NUnit.Framework.Category ("MobileNotWorking")]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void TestDoubleBeginErrorReadLine ()
+ {
+ using (Process p = new Process ()) {
+ p.StartInfo = GetCrossPlatformStartInfo ();
+ p.StartInfo.UseShellExecute = false;
+ p.StartInfo.RedirectStandardOutput = true;
+ p.StartInfo.RedirectStandardError = true;
+
+ p.Start ();
+
+ p.BeginErrorReadLine ();
+ p.BeginErrorReadLine ();
+
+ Assert.Fail ();
+ }
+ }
}
}