Throws.Nothing doesn't work properly
Bug #666800 reported by
Michael Naumov
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit V2 |
Fix Released
|
Low
|
Charlie Poole |
Bug Description
The folowing Assert shouldn't fail but it fails
[Test]
public void NotThrown()
{
Assert.That(() => null, Throws.Nothing);
}
NUnitBug.
System.
Parameter name: actual
at NUnit.Framework
at NUnit.Framework
at NUnitBug.
Related branches
Changed in nunitv2: | |
status: | New → Triaged |
importance: | Undecided → Low |
tags: | added: easy |
Changed in nunitv2: | |
milestone: | none → 2.5.9 |
assignee: | nobody → Charlie Poole (charlie.poole) |
Changed in nunitv2: | |
status: | Triaged → Fix Committed |
Changed in nunitv2: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Tested on the latest version of NUnit: 2.5.8.10295
Due to source code it seems to be issue in the fact that nstraint class doesn't override the following method from Constraint class
ThrowsNothingCo
public virtual bool Matches( ActualValueDele gate del) del());
{
return this.Matches(
}
it's should be overriden with
public override bool Matches( ActualValueDele gate del) actual) ;
{
TestDelegate actual = delegate {
del();
};
return this.Matches(
}
(like in ThrowsConstraint class)