NUnitEx 1.0.4 was released today (download).
Charlie Poole, NUnit’s project leader, included NUnitEx as official NUnit AddOns “under review for possible inclusion in NUnit 3.0” (thanks Charlie) and we are looking for some response from users (the thread is here).
News
Shorten Enumerable Constraints
Some constraints now accept a params T[] so you can write more concise assertion when the expected value is know.
var ints = new[] { 1, 2, 3 };
ints.Should().Have.SameSequenceAs(1, 2, 3);
ints.Should().Have.SameValuesAs(3, 2, 1);
ints.Should().Be.SubsetOf(1, 2, 3, 4);
These new overloads was implemented extending the extensions. ;-)
Count assertion
The Count assertion can be useful in two ways:
To have a “more readable” assertion: ints.Should().Have.Count.EqualTo(3)
As chainable assertion for IEnumerable<T>: ints.Should().Contain(3).And.Not.Have.Count.LessThan(2);
Notes
Thanks to José Romaniello NUnitEx was tested on Mono.
If you have some proposal please don’t hesitate to share it.
Intelliscence can be your friend also in monodevelop.
ReplyDeleteGreat work Fabio.
Problems:
ReplyDelete1. I The tests failed for this sample:
MyClass.IsValid().Should().Be.False();
Exception: System.TypeLoadException : Can't load type "NUnit.Framework.Is" from assembly "nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77".
2. The code:
MyClass.IsValid().Should().Not.Be.False();
does not compiled, error: NUnit.Framework.IBooleanConstarints does not contains definition for "Not"
NUnitEx1.0.4 is working with NUnit2.5
ReplyDeleteI included the latest NUnit and NUnitEx assemblies in my test project but my GUIRunner (Galio) still throws exception about NUnit 2.4.8.0 If I modified test project without using NUnitEx all works fine.
ReplyDeleteAny suggettions?
Remove NUnit from the GAC and/or ensure GALIO is compiled for NUnit2.5.1.
ReplyDeleteBtw we can use the http://groups.google.com/group/nunit-discuss
Thanks!
ReplyDelete@s_tristan
ReplyDeleteHave you solved ?
Solved!
ReplyDeleteProblem was in incorrect dll binding app.config file in my test project.
Huch!!!
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete