← Back to team overview

nunit-core team mailing list archive

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

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/725718

Title:
  Documented overloads of Has.Property do not exist

Status in NUnit V2 Test Framework:
  New

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.



References