Just a quick post to let you all know that I’ve just published a new version of Fluent Assertions with a load of little improvements that will improve your life as a unit test developer a little bit.
CompareEnumsAsValueto the options taken by
ShouldBeEquivalentToso specify how enumerations are compared.
WithInnerExceptionExactlyto assert a specific exception was thrown rather than the default of allowing sub-classes of those exceptions. #176
- Introduced a new static
AssertionOptionsclass that can be used to change the defaults used by
ShouldBeEquivalentTo, alter the global collection of
IEquivalencySteps that are used internally, and change the rules that are used to identify value types. #134
ShouldBeEquivalentTowill now also include public fields. Obviously, this can be changed using a set of new members on the
EquivalencyAssertionOptions<T>class that the equivalency API takes.
- Extended the collection assertions with
- Added methods
ThatImplementto filter types from assemblies that need to comply to certain prerequisites.
BeAssignableTothat directly apply to
Minor improvements and fixes
- Extended the time-conversion convenience methods with
- When an object implements
IDictionary<T,K>more than once,
ShouldBeEquivalentTowill fail rather than pick a random implementation. Likewise, if a dictionary only implements
IDictionary<,>explicitly, it will still be treated as a dictionary. Finally,
ShouldBeEquivalentTowill now respect the declared type of a generic dictionary.
- A null reference in a nested collection wasn't properly detected by
- Corrected the remaining cases where
ShouldBeEquivalentTodid not respect the declared type. #161
- Adding an overload to
collection.ContainSingle()having no arguments.
- Included the time zone offset when displaying a
collection.Should().BeEmpty()now properly reports the collection items it found unexpectedly. #224
- Made the fallback
AssertFailedExceptionserializable to help in certain cross-
AppDomainunit tests. #214
- Better support for rendering the
MaxValuewithout causign stack overflow exceptions. #212
- Fixed an issue where the Windows 8.1 test framework detection code would ran into a deadlock when using a
- Fixed an issue where
ShouldBeEquivalentTowould throw an internal exception on a unset
- We now use StyleCop to improve the quality level of the code.
- The first steps have been taken to deprecate
- The internal assertion API has been changed to allow chaining complex assertions using a fluent API. This should make it a lot easier to extend Fluent Assertions. You can read more about that in this blog post
- We've started to use Chill to improve the readability of the more behavioral unit tests.
As usual, you can get the bits from NuGet or through the main landing page. Tweet me at @ddoomen for questions or post them on StackOverflow. If you find any issues, post them to the GitHub repository.