On Saturday, May 19, 2012 11:16:46 AM UTC-5, Graham Hay wrote:
Pull
requests will be gratefully received :)
Yep, and I've forked in hopes of adding to it. Thinking the Property constraints could be useful (also in the Hamcrest library).
Which matchers do you think would be useful?
What I find myself struggling with most is collection comparison. What I really want is something LINQ-like. Maybe pass a lambda or something to decide whether I have an item in the collection that I was expecting. Since the objects can be very complex or might not override Equals, I want to be able to do something like Assert.That(collection, Has.Item.Where(x => x.Property == "expected"). (NUnit doesn't really seem to have this either, but I do like their fluent style syntax with modifiers... for example, Is.Not.GreaterThan(3) is a bit easier than Is.Not(Is.GreaterThan(3)) or adding an IgnoreCase modifier to string comparisons...). That make any sense? Or is there an easier way to accomplish this?
The motivation for using the Hamcrest matchers, rather than the NUnit ones, was that all the existing body of knowledge around the Java version (and others) would still be relevant. Whether that was a good idea remains to be seen.
I think that still holds true. FWIW, looks like Hamcrest is moving to GitHub as well. Might want to add NHamcrest under the
https://github.com/hamcrest umbrella?
On 17 May 2012 20:53, Andrew Ochsner wrote:
Very happy to see and use the Assert.That syntax but the NHamcrest matchers seem a bit limited and there hasn't been much in the way of development it seems. Meanwhile NUnit seems to have a much more robust set of matchers/constraints (
http://nunit.org/index.php?p=constraintModel&r=2.6 ). Are there any plans to either change the approach or develop more matchers to donate to NHamcrest (something I've been trying to work on in my spare time)?
Thanks