nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #00318
[Bug 532488] [NEW] constraints from ConstraintExpression/ConstraintBuilder are not reusable
Public bug reported:
Constraint that I receive from syntax helper (Is.Not.Null) is not reusable, but I guess this is more general problem.
I found this problem when upgrading nunit.framework.dll from v2.4.6 to v.2.5.3. In both cases tests were executed witn NUnit 2.5.3 console.
Worst thing about this problem seems that tests could actually pass when they should fail if you reuse constraint.
Here is simple example that demonstrates the problem:
using NUnit.Framework;
using NUnit.Framework.Constraints;
namespace NUnit_2_5_3_bug
{
[TestFixture]
public class FailToReuseConstraint
{
/// <summary>
/// Constraint from <see cref="ConstraintExpression"/>.
/// </summary>
/// <remarks>
/// Demonstrates that constraint received from syntax helper is not reusable.
/// </remarks>
[Test]
public void FromSyntaxHelper()
{
Constraint expression = Is.Not.Null;
Assert.That(this, expression, "one");
Assert.That(this, expression, "two"); // this step fails on NUnit.2.5.3
}
/// <summary>
/// How NUnit 2.4 did it (i think).
/// </summary>
[Test]
public void NotConstraint()
{
Constraint expression = new NotConstraint(Is.Null);
Assert.That(this, expression, "one");
Assert.That(this, expression, "two");
}
}
}
** Affects: nunitv2
Importance: Undecided
Status: New
--
constraints from ConstraintExpression/ConstraintBuilder are not reusable
https://bugs.launchpad.net/bugs/532488
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: New
Bug description:
Constraint that I receive from syntax helper (Is.Not.Null) is not reusable, but I guess this is more general problem.
I found this problem when upgrading nunit.framework.dll from v2.4.6 to v.2.5.3. In both cases tests were executed witn NUnit 2.5.3 console.
Worst thing about this problem seems that tests could actually pass when they should fail if you reuse constraint.
Here is simple example that demonstrates the problem:
using NUnit.Framework;
using NUnit.Framework.Constraints;
namespace NUnit_2_5_3_bug
{
[TestFixture]
public class FailToReuseConstraint
{
/// <summary>
/// Constraint from <see cref="ConstraintExpression"/>.
/// </summary>
/// <remarks>
/// Demonstrates that constraint received from syntax helper is not reusable.
/// </remarks>
[Test]
public void FromSyntaxHelper()
{
Constraint expression = Is.Not.Null;
Assert.That(this, expression, "one");
Assert.That(this, expression, "two"); // this step fails on NUnit.2.5.3
}
/// <summary>
/// How NUnit 2.4 did it (i think).
/// </summary>
[Test]
public void NotConstraint()
{
Constraint expression = new NotConstraint(Is.Null);
Assert.That(this, expression, "one");
Assert.That(this, expression, "two");
}
}
}
Follow ups
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Charlie Poole, 2010-07-31
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Charlie Poole, 2010-07-26
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Launchpad Bug Tracker, 2010-07-26
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Charlie Poole, 2010-07-25
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Charlie Poole, 2010-07-25
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Launchpad Bug Tracker, 2010-07-20
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Charlie Poole, 2010-07-20
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Charlie Poole, 2010-07-17
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Charlie Poole, 2010-07-16
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Olof Bjarnason, 2010-03-05
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: blaz, 2010-03-05
-
[Bug 532488] Re: constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: Olof Bjarnason, 2010-03-05
-
[Bug 532488] [NEW] constraints from ConstraintExpression/ConstraintBuilder are not reusable
From: blaz, 2010-03-05
References