cs-codex-dist-tests/Tests/DistTestCore/Helpers/AssertHelpers.cs

26 lines
649 B
C#
Raw Normal View History

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
{
Time.WaitUntil(() => {
var c = constraint.Resolve();
return c.ApplyTo(actual()).IsSuccess;
2024-04-14 07:17:25 +00:00
}, "RetryAssert: " + message);
}
catch (TimeoutException)
{
Assert.That(actual(), constraint, message);
}
}
}
}