← Back to team overview

nunit-core team mailing list archive

[Bug 600627] Re: Assertion message formatted poorly by PropertyConstraint

 

** Changed in: nunitv2
       Status: Triaged => Fix Committed

-- 
Assertion message formatted poorly by PropertyConstraint 
https://bugs.launchpad.net/bugs/600627
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.

Status in NUnit Test Framework: Triaged
Status in NUnit V2 Test Framework: Fix Committed

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)));

		}
	}





References