Search code examples
nunitpostsharp

Can I add a message to NUnit assertion using PostSharp


How can I change my Assert statement behaviour from:

Assert.That(User.HasOrderInvoice, Is.True)

to

Assert.That(User.HasOrderInvoice, Is.True, "Assert.That(User.HasOrderInvoice, Is.True)")

using PostSharp.

I know that Fody has an addin AssertMessage.Fody that can do this. I use PostSharp and I am not able to figure this out. Can someone please help?


Solution

  • You cannot do that with PostSharp (you would need an add-in, but PostSharp's add-in API is not documented and not supported).