return read_timeout;
}
set {
- if (value <= 0 && value != InfiniteTimeout)
+ if (value < 0 && value != InfiniteTimeout)
throw new ArgumentOutOfRangeException ("value");
if (is_open)
return write_timeout;
}
set {
- if (value <= 0 && value != InfiniteTimeout)
+ if (value < 0 && value != InfiniteTimeout)
throw new ArgumentOutOfRangeException ("value");
if (is_open)
Assert.IsTrue(exceptionCatched,
"Exception not thrown despite wrong baud rate");
}
+
+ /// <summary>
+ /// This test is related to bug #635971
+ /// </summary>
+ [Test]
+ public void ZeroTimeout ()
+ {
+ var sp = new SerialPort ();
+ var exceptionThrown = false;
+ try {
+ sp.ReadTimeout = 0;
+ } catch(ArgumentOutOfRangeException) {
+ exceptionThrown = true;
+ }
+ Assert.IsFalse(exceptionThrown,
+ "Exception thrown despite proper timeout (0)");
+ }
+
}
}