2023-06-01 14:28:34 +00:00
|
|
|
|
using NUnit.Framework.Constraints;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Utils;
|
|
|
|
|
|
|
|
|
|
namespace DistTestCore.Helpers
|
|
|
|
|
{
|
|
|
|
|
public static class AssertHelpers
|
|
|
|
|
{
|
|
|
|
|
public static void RetryAssert<T>(IResolveConstraint constraint, Func<T> actual, string message)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2023-09-14 04:45:25 +00:00
|
|
|
|
|
|
|
|
|
Time.WaitUntil(() => {
|
|
|
|
|
var c = constraint.Resolve();
|
|
|
|
|
return c.ApplyTo(actual()).IsSuccess;
|
2024-04-14 07:17:25 +00:00
|
|
|
|
}, "RetryAssert: " + message);
|
2023-06-01 14:28:34 +00:00
|
|
|
|
}
|
|
|
|
|
catch (TimeoutException)
|
|
|
|
|
{
|
|
|
|
|
Assert.That(actual(), constraint, message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|