← Back to team overview

nunit-core team mailing list archive

Re: [Bug 623240] [NEW] Has.Property does not work as expected

 

In the internal workings of NUnit, the constraint is, in fact, an
equal constraint, with
an unresolved property operator on the operator stack. This is what
allows you to
continue and add EqualConstrant modifiers like Within to the expression.

The constraint is resolved when it is used and becomes a property
constraint.

See also bug #532488.

On Tue, Aug 24, 2010 at 1:47 AM, Peter Strøiman
<623240@xxxxxxxxxxxxxxxxxx> wrote:
> Public bug reported:
>
> Well, the following test describes how I would have expected the
> Has.Property() function to work.
>
>        [Test]
>        public void NUnitTest()
>        {
>            var constraint = Has.Property("X").EqualTo("Y");
>            Assert.That(constraint, Is.InstanceOf<PropertyConstraint>());
>
>            // Fails with:
>            // Expected: instance of <NUnit.Framework.Constraints.PropertyConstraint>
>            // But was:  <NUnit.Framework.Constraints.EqualConstraint>
>        }
>
> ** Affects: nunitv2
>     Importance: Undecided
>         Status: New
>
> --
> Has.Property does not work as expected
> https://bugs.launchpad.net/bugs/623240
> You received this bug notification because you are a member of NUnit
> Developers, which is subscribed to NUnit V2.
>

** Changed in: nunitv2
       Status: New => Invalid

-- 
Has.Property does not work as expected
https://bugs.launchpad.net/bugs/623240
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.

Status in NUnit V2 Test Framework: Invalid

Bug description:
Well, the following test describes how I would have expected the Has.Property() function to work.

        [Test]
        public void NUnitTest()
        {
            var constraint = Has.Property("X").EqualTo("Y");
            Assert.That(constraint, Is.InstanceOf<PropertyConstraint>());

            // Fails with:
            // Expected: instance of <NUnit.Framework.Constraints.PropertyConstraint>
            // But was:  <NUnit.Framework.Constraints.EqualConstraint>
        }





References