TUX004 - Missing failure message for refinement
The Refinement attribute must have a FailureMessage property set to a
non-empty string or the method it's applied to must return a string? which
when non-empty is used as the failure message.
The FailureMessage property can be set either via the constructor or via the
property setter.
using Tuxedo;
public class Test
{
// the following are invalid
[Refinement]
public static bool IsPositive(int value) => value > 0;
// missing the nullable attribute on string
[Refinement]
public static string IsPositive(int value) =>
value > 0 ? null : "Value must be positive";
// the following are valid
[Refinement("Value must be positive")]
public static bool IsPositive(int value) => value > 0;
[Refinement(FailureMessage = "Value must be positive")]
public static bool IsPositive(int value) => value > 0;
[Refinement]
public static string? IsPositive(int value) =>
value > 0 ? null : "Value must be positive";
}