Agile Zone is brought to you in partnership with:

Dennis is Principal Consultant at Aviva Solutions, speaker, author, coach, specialized in ALM, TDD, DDD, design patterns, architecture, Agile, TFS and Silverlight. He published coding guidelines for C#3.0 and C#4.0 and maintains multiple open-source .NET projects. You can tweet him at @ddoomen Dennis is a DZone MVB and is not an employee of DZone and has posted 40 posts at DZone. You can read more from them at their website. View Full User Profile

Fluent Assertions is finally gaining some momentum

11.09.2011
| 3832 views |
  • submit to reddit

Indeed it is, in particular within the part of the .NET community that believes test-first development is non-negotiable. We receive more and more suggestions, contributions and questions, and we’ve started to notice some blog posts here and there.

It’s not that it is being downloaded thousands of times per month, but since its first release in February 2010 it has been downloaded 1738 times through CodePlex. The biggest increase was caused by NuGet though. Since we’ve uploaded our first NuGet package in January this year, it counted 2863 downloads. That’s more than enough to make us happy.

Anyway, after having tested several intermediate versions in one of our major projects, we’ve finally released version 1.6.0. And yes, we’re doing semantic versioning, so this version should only add new functionality, bug fixes and no breaking changes compared to 1.5.0. All credits for this release go to my fellow colleague and close friend Martin Opdam. He spend more actual development time than me, and I’m very happy with that because it allows me to keep my focus on the Silverlight Cookbook for a while more. We are also happy to see that the contributions are coming as well. For instance, Urs Enzler has been quite active and provided various patches. He’s even trying to set us up with a continuous integration server based on TeamCity.

So what's new?

  • And() extension method to TimeSpanConversionExtensions to support 4.Hours().And(30.Minutes()).
  • More TimeSpan extensions to fluently create a TimeSpan like 23.Hours(59.Minutes()).And(20.Seconds()).
  • MSpec as contributed by Urs Enzler.
  • Support for the ComparisonMode to assert inner exception messages as well. Also added ComparisonMode Equivalent and EquivalentSubstring to assert that the message of an (inner) exception matches a certain case-insensitive phrase.
  • Guid assertions like Be(), NotBe(), BeEmpty() and NotBeEmpty().
  • Support for recursively comparing the properties of nested objects using ShouldHave().AllProperties().IncludingNestedObjects().EqualTo().
  • Type and MethodInfo assertions for asserting class members are virtual or decorated with specific attributes.
  • Before() and After() extensions methods for TimeSpans .
  • Should().Be() and NotBe() extensions to the TypeAssertions.
  • Added PDB files to the release build as another contribution by Urs Enzler.
  • Added the name of the property to the ShouldFirePropertyChanged extension method failure message, also contributed by Urs Enzler.
  • Added missing comments to some of the assertion classes.

What did we fix?

  • Fixed a stack overflow exception due to a recursive call between the various overloads of floating point extension method BeApproximately()
  • While comparing two collections for equality, FA didn't check any superfluous items in the expected collection.
  • Boolean assertions did not properly check against null values.
  • Fixed a stack overflow exception while creating a displayable representation of an object that contains circular references.
  • Fixed some potential memory leaks fix in MonitorEvents() using a patch provided by Remo Gloor.
  • Sometimes the wrong name of a the property or type was reported in a failure message.
  • ShouldHave().AllProperties().EqualTo() sometimes treated two objects that are functional equivalent according to their Equals() override as different, simply because they were not of the same type.
  • Fixed the detection of collection items that appear in the wrong order in Should().ContainInOrder().

Release 1.6.0 can be downloaded from its CodePlex site, but I suggest you start using NuGet as your primary delivery mechanism.

References
Published at DZone with permission of Dennis Doomen, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Robert Craft replied on Thu, 2012/01/26 - 6:08am

Nothing is more annoying then a unit test that fails without clearly explaining why. More than often, you need to set a breakpoint and start up the debugger to be able to figure out what went wrong. "keep out of the debugger hell" and I can only agree with that. For instance, only test a single condition per test case. If you don't, and the first condition fails, the test engine will not even try to test the other conditions. But if any of the others fail, you'll be on your own to figure out which one. I often run into this problem when developers try to combine multiple related tests that test a member using different parameters into one test case. If you really need to do that, consider using a parameterized test that is being called by several clearly named test cases.

Spring Security

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.