Fluent Assertions 3.3.0

@dennisdoomen dennisdoomen released this Feb 18, 2015 · 747 commits to master since this release

New features

  • Added CompareEnumsAsString and CompareEnumsAsValue to the options taken by ShouldBeEquivalentTo so specify how enumerations are compared.
  • Added ShouldThrowExactly and WithInnerExceptionExactly 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 by ShouldBeEquivalentTo, alter the global collection of IEquivalencySteps 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 the EquivalencyAssertionOptions<T> class that the equivalency API takes.
  • Extended the collection assertions with StartWith, EndWith, HaveElementPreceding and HaveElementSucceeding.
  • Added methods ThatAreDecoratedWith, ThatAreInNamespace, ThatAreUnderNamespace, ThatDeriveFrom and ThatImplement 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 implements IDictionary<,> 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's MinValue and MaxValue 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 unset byte[] 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.