Nunit and PropertyConstraint
The PropertyConstraint of nunit is useful to assert some condition on a property of an object. This constraint permits to specify the Name of the property and then a constraint on his value. The only thing that miss is a better error message when the object does not contains the specified property. Suppose you write a wrong test like this
|
|
This test will fail because the List does not have PropB property, the error from nunit is.
*Expected: Property “PropB” 2
But was: <System.Collections.Generic.List`1[SimpleTwoProps]>*
This sounds not so interesting to me, it could be better to modify the WriteActualValueTo
|
|
With this modification the error is much more clear
Expected: Property “PropB” 2
But was: “The property PropB was not found on type System.Collections.Generic.List`1[SimpleTwoProps]
This message is much more clear for me.
Alk.