Context
in XUnit github I found this: Add Assert.Equal(expected, actual, message) overload #350 (so a developer ask for a non existing overload see below)
Quote from the answer:
We are a believer in self-documenting code; that includes your assertions.
(so the XUnit team rejects it)
OK, I got it. I also believe the self documenting code. Still I can not find out this use case:
Sample
// Arrange
// Create some external soap service client and its wrapper classes
// Act
// client.SomeMethod();
// Assert
// Sorry, soap service's interface, behaviour and design is *given*
// So I have to check if there is no Error, and
// conveniently if there is, then I would like to see it in the assertion message
Assert.Equal(0, client.ErrorMessage.Length); // Means no error
// I would like to have the same result what would be the following *N*U*n*i*t* assert:
// Assert.AreEqual(0, client.ErrorMessage.Length, client.ErrorMessage); // Means no error
Question
How can I implement a descriptive assert message in this case in XUnit which still has no such an overload?
Use the suggestions provided at the link. Like fluent assertions or create your own assertion that wraps the
Assert.True or Assert.Falsewhich were left with their message overloads. It was mentioned further downQuote
Quote: