public void TestGetValueWhichDoesTimeOut() { BlockingCell k = new BlockingCell(); ResetTimer(); Assert.Throws <TimeoutException>(() => k.GetValue(TimingInterval)); }
public void TestGetValueWhichDoesTimeOutWithTimeSpan() { BlockingCell k = new BlockingCell(); ResetTimer(); Assert.Throws <TimeoutException>(() => k.GetValue(TimeSpan.FromMilliseconds(TimingInterval))); }
public void TestBackgroundUpdateFails() { BlockingCell k = new BlockingCell(); SetAfter(TimingInterval * 2, k, 123); ResetTimer(); Assert.Throws <TimeoutException>(() => k.GetValue(TimingInterval)); }
public void TestGetValueWhichDoesNotTimeOut() { BlockingCell k = new BlockingCell(); k.Value = 123; ResetTimer(); var v = k.GetValue(TimingInterval); Assert.Greater(SafetyMargin, ElapsedMs()); Assert.AreEqual(123, v); }
public void TestBackgroundUpdateSucceedsWithInfiniteTimeoutTimeSpan() { BlockingCell k = new BlockingCell(); SetAfter(TimingInterval, k, 123); ResetTimer(); var v = k.GetValue(Timeout.InfiniteTimeSpan); Assert.Less(TimingInterval - SafetyMargin, ElapsedMs()); Assert.AreEqual(123, v); }
public void TestGetValueWithTimeoutInfinite() { BlockingCell k = new BlockingCell(); SetAfter(TimingInterval, k, 123); ResetTimer(); var v = k.GetValue(Timeout.Infinite); Assert.Less(TimingInterval - SafetyMargin, ElapsedMs()); Assert.AreEqual(123, v); }
public void TestTimeoutNegative() { BlockingCell k = new BlockingCell(); ResetTimer(); object v; bool r = k.GetValue(-10000, out v); Assert.Greater(SafetyMargin, ElapsedMs()); Assert.IsTrue(!r); Assert.AreEqual(null, v); }
public void TestTimeoutLong() { BlockingCell k = new BlockingCell(); ResetTimer(); object v; bool r = k.GetValue(TimingInterval, out v); Assert.Less(TimingInterval - SafetyMargin, ElapsedMs()); Assert.IsTrue(!r); Assert.AreEqual(null, v); }
public void TestTimeoutShort() { BlockingCell k = new BlockingCell(); k.Value = 123; ResetTimer(); object v; bool r = k.GetValue(TimingInterval, out v); Assert.Greater(SafetyMargin, ElapsedMs()); Assert.IsTrue(r); Assert.AreEqual(123, v); }
public void TestBgLong() { BlockingCell k = new BlockingCell(); SetAfter(TimingInterval * 2, k, 123); ResetTimer(); object v; bool r = k.GetValue(TimingInterval, out v); Assert.Greater(TimingInterval + SafetyMargin, ElapsedMs()); Assert.IsTrue(!r); Assert.AreEqual(null, v); }
public void TestBgShort() { BlockingCell k = new BlockingCell(); SetAfter(TimingInterval, k, 123); ResetTimer(); object v; bool r = k.GetValue(TimingInterval * 2, out v); Assert.Less(TimingInterval - SafetyMargin, ElapsedMs()); Assert.IsTrue(r); Assert.AreEqual(123, v); }
public virtual Command GetReply(TimeSpan timeout) { var result = (Either)m_cell.GetValue(timeout); switch (result.Alternative) { case EitherAlternative.Left: return((Command)result.Value); case EitherAlternative.Right: throw new OperationInterruptedException((ShutdownEventArgs)result.Value); default: ReportInvalidInvariant(result); return(null); } }
public ShutdownEventArgs Wait(TimeSpan timeout) { return((ShutdownEventArgs)m_cell.GetValue(timeout)); }