New features
- Added
CompareEnumsAsString
andCompareEnumsAsValue
to the options taken byShouldBeEquivalentTo
so specify how enumerations are compared. - Added
ShouldThrowExactly
andWithInnerExceptionExactly
to assert a specific exception was thrown rather than the default of allowing sub-classes of those exceptions. #176 - Introduced a new static
AssertionOptions
class that can be used to change the defaults used byShouldBeEquivalentTo
, alter the global collection ofIEquivalencyStep
s that are used internally, and change the rules that are used to identify value types. #134 ShouldBeEquivalentTo
will now also include public fields. Obviously, this can be changed using a set of new members on theEquivalencyAssertionOptions<T>
class that the equivalency API takes.- Extended the collection assertions with
StartWith
,EndWith
,HaveElementPreceding
andHaveElementSucceeding
. - Added methods
ThatAreDecoratedWith
,ThatAreInNamespace
,ThatAreUnderNamespace
,ThatDeriveFrom
andThatImplement
to filter types from assemblies that need to comply to certain prerequisites. - Added
BeAssignableTo
that directly apply toType
objects.
Minor improvements and fixes
- Extended the time-conversion convenience methods with
4.Ticks()
- When an object implements
IDictionary<T,K>
more than once,ShouldBeEquivalentTo
will fail rather than pick a random implementation. Likewise, if a dictionary only implementsIDictionary<,>
explicitly, it will still be treated as a dictionary. Finally,ShouldBeEquivalentTo
will now respect the declared type of a generic dictionary. - A null reference in a nested collection wasn't properly detected by
ShouldBeEquivalentTo
. - Corrected the remaining cases where
ShouldBeEquivalentTo
did not respect the declared type. #161 - Adding an overload to
collection.ContainSingle()
having no arguments. - Included the timezone offset when displaying a
DateTimeOffset
. #160 collection.Should().BeEmpty()
now properly reports the collection items it found unexpectedly. #224- Made the fallback
AssertFailedException
serializable to help in certain cross-AppDomain
unit tests. #214 - Better support for rendering the
TimeSpan
'sMinValue
andMaxValue
without 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
[UITestMethod]
. #223 - Fixed an issue where
ShouldBeEquivalentTo
would throw an internal exception on a unsetbyte[]
property. #165
Internal changes
- We now use StyleCop to improve the quality level of the code.
- The first steps have been taken to deprecate
IAssertionRule
. - 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.