mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
Tidying
This commit is contained in:
parent
3322b2038f
commit
3ff80a2a39
3 changed files with 6 additions and 10 deletions
|
|
@ -48,9 +48,8 @@ namespace ICD.Common.Utils.Tests
|
|||
|
||||
// ReSharper disable once NotAccessedVariable
|
||||
object handle = ThreadingUtils.SafeInvoke(() => { result = section.TryEnter() ? 0 : 1; });
|
||||
ThreadingUtils.Sleep(1000);
|
||||
|
||||
Assert.AreEqual(1, result);
|
||||
|
||||
Assert.IsTrue(ThreadingUtils.Wait(() => result == 1, 1000));
|
||||
|
||||
section.Leave();
|
||||
|
||||
|
|
@ -60,9 +59,8 @@ namespace ICD.Common.Utils.Tests
|
|||
result = section.TryEnter() ? 2 : 0;
|
||||
section.Leave();
|
||||
});
|
||||
ThreadingUtils.Sleep(1000);
|
||||
|
||||
Assert.AreEqual(2, result);
|
||||
Assert.IsTrue(ThreadingUtils.Wait(() => result == 2, 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ namespace ICD.Common.Utils.Tests
|
|||
});
|
||||
|
||||
Assert.IsFalse(result);
|
||||
ThreadingUtils.Sleep(1000);
|
||||
Assert.IsTrue(result);
|
||||
Assert.IsTrue(ThreadingUtils.Wait(() => result, 1000));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -59,8 +58,7 @@ namespace ICD.Common.Utils.Tests
|
|||
}, true);
|
||||
|
||||
Assert.IsFalse(result);
|
||||
ThreadingUtils.Sleep(1000);
|
||||
Assert.IsTrue(result);
|
||||
Assert.IsTrue(ThreadingUtils.Wait(() => result, 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace ICD.Common.Utils
|
|||
/// </summary>
|
||||
/// <param name="condition"></param>
|
||||
/// <param name="timeout"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>False if the call times out</returns>
|
||||
public static bool Wait(Func<bool> condition, long timeout)
|
||||
{
|
||||
if (condition == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue