mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-11 10:45:05 +00:00
Tidying
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user