According to Charlie Poole's NUnit blog, it is possible to use Lambda expressions as constraints in NUnit 2.5. I just can't seem to be able to get it to work? I am using NUnit 2.5.3.9345.
Using the example lambda from the blog post:
[TestFixture]
public class Class1
{
[Test]
public void someTest()
{
int[] array = {1, 2, 3, 4};
Assert.That( array, Is.All.Matches( (x) => x%4 == 0 && x%100 != 0 || x%400 == 0 ));
}
}
Results in the compiler saying: "Cannot convert lambda expression to type 'NUnit.Framework.Constraints.Constraint' because it is not a delegate type"
The Target Framework of the assembly is .NET Framework 3.5. Is there something I'm stupidly doing wrong?