-
Notifications
You must be signed in to change notification settings - Fork 291
Milestone
Description
Description
With .Net 6 Caller Argument Expression was added, this could be used in testfx to provide the expression which failed the check. Doing this could provider consumers more out of the box detail about what caused the assert to fail without having to manually provide messages.
Sample Code change
#if !NET6_0_OR_GREATER
public static void IsNull(object value)
{
IsNull(value, string.Empty, null);
}
#endif
public static void IsNull(
object value,
#if !NET6_0_OR_GREATER
string message)
#else
[CallerArgumentExpression("value")]string message = "")
#endif
{
IsNull(value, message, null);
}
Work required
- Add .Net 6 as a built/packaged runtime
- Modify Assert code to make the flows without a message removed in .Net 6 so that code like
Assert.IsNull(myParam)execute passingmyParamas the message.
Change in behavior
Currently a failing call to Assert.IsNull without a message will just return Assert.IsNull failed. This would change to Assert.IsNull failed. myParam which could be considered a breaking change and a result a no-go.
gao-artur, gerleim and TiltonJH