Assertion message formatted poorly by PropertyConstraint

Bug #600627 reported by Peter Strøiman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
Fix Released
Medium
Charlie Poole
NUnit V2
Fix Released
Medium
Charlie Poole

Bug Description

When I place an EqualConstraint with a tolerance inside a PropertyConstraint, the error message fails to format the tolerance.

So this is only a formatting issue, the test gives the correct result.

The following code reproduces the bug.

This was observed in NUnit version 2.5.5.10112
The code is compiled in Visual Studio 2010 targeting .NET 4.0 framework

 public class C { public decimal d { get; set; } }

 [TestFixture]
 public class T
 {
  [Test]
  public void PropertyConstraintTest()
  {
   var c = new C { d = 100.0m };
   // Write the error message
   // Expected: 105m +/- 0.1m
   // But was: 100m
   //Assert.That(c.d, new EqualConstraint(105m).Within(0.1m));

   // Writes the error message
   // Expected: property d equal to 105m +/- <NUnit.Framework.Constraints.Tolerance>
   // But was: 100m
   Assert.That(c, new PropertyConstraint("d", new EqualConstraint(105m).Within(0.1m)));

  }
 }

Tags: v2port

Related branches

Changed in nunitv2:
status: New → Triaged
importance: Undecided → Medium
Changed in nunit-3.0:
status: New → Triaged
importance: Undecided → Medium
Changed in nunitv2:
assignee: nobody → Charlie Poole (charlie.poole)
milestone: none → 2.5.6
Changed in nunitv2:
status: Triaged → Fix Committed
Changed in nunitv2:
status: Fix Committed → Fix Released
tags: added: v2port
Changed in nunit-3.0:
assignee: nobody → Charlie Poole (charlie.poole)
milestone: none → 2.9.5
status: Triaged → Fix Committed
Changed in nunit-3.0:
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.