Monday, 26 March 2012

Fluent Assertions

Using the Fluent Assertions framework in your tests can make your code more compact and readable.

Take this simple example of testing a clone method by asserting that two instances of the same object have the same property values.

Without Fluent Assertions:

With Fluent Assertions:

In this example I happen to have used xUnit to create my tests.

Here’s the same example comparing all properties except the Id property:

Fluent Assertions:  http://fluentassertions.codeplex.com/

xUnit:  http://xunit.codeplex.com/

No comments:

Post a Comment