nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #01243
[Bug 666800] Re: Throws.Nothing doesn't work properly
Tested on the latest version of NUnit: 2.5.8.10295
Due to source code it seems to be issue in the fact that
ThrowsNothingConstraint class doesn't override the following method from Constraint class
public virtual bool Matches(ActualValueDelegate del)
{
return this.Matches(del());
}
it's should be overriden with
public override bool Matches(ActualValueDelegate del)
{
TestDelegate actual = delegate {
del();
};
return this.Matches(actual);
}
(like in ThrowsConstraint class)
--
Throws.Nothing doesn't work properly
https://bugs.launchpad.net/bugs/666800
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:
The folowing Assert shouldn't fail but it fails
[Test]
public void NotThrown()
{
Assert.That(() => null, Throws.Nothing);
}
NUnitBug.Tester.NotThrown:
System.ArgumentException : The actual value must be a TestDelegate
Parameter name: actual
at NUnit.Framework.Constraints.ThrowsNothingConstraint.Matches(Object actual)
at NUnit.Framework.Constraints.Constraint.Matches(ActualValueDelegate del)
at NUnitBug.Tester.NotThrown()
References