Documented overloads of Has.Property do not exist

Bug #725718 reported by Joe White
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit V2
Fix Released
High
Charlie Poole

Bug Description

Using NUnit 2.5.9.

According to the documentation at http://www.nunit.org/index.php?p=propertyConstraint&r=2.5.9, Has.Property has three overloads: one that just takes a property name; one that takes a property name and an object, with implied "Is.EqualTo" semantics; and one that takes a property name and a constraint.

In reality, Has.Property only has one overload, which is the first of the three (only takes the property name). If you want to specify a constraint for the property value, you have to explicitly do "new PropertyConstraint(...)".

Either fix the documentation, or (better yet) add the documented-but-missing overloads.

Revision history for this message
Charlie Poole (charlie.poole) wrote : Re: [Bug 725718] [NEW] Documented overloads of Has.Property do not exist

The missing overloads once existed and were removed. The documentation
will be corrected.

However, the statement...

> If you want to specify a
> constraint for the property value, you have to explicitly do "new
> PropertyConstraint(...)".

is incorrect.

You can express constraints on properties using code similar to this...

Assert.That(obj, Has.Property("PropertyName").EqualTo(expected));

Charlie

Revision history for this message
Charlie Poole (charlie.poole) wrote :

The page has been updated in the online docs in preparation for the next release.

Changed in nunitv2:
importance: Undecided → High
assignee: nobody → Charlie Poole (charlie.poole)
milestone: none → 2.5.10
status: New → Fix Committed
Changed in nunitv2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.