Releases: fluentassertions/fluentassertions
Releases · fluentassertions/fluentassertions
4.2.0
- Added
datetime.Should().BeSameDateAs()
- #319 (by @blairconrad) - Added overloads to
dictionary.Should().Contain()
andNotContain
that take an enumerable ofKeyValuePairs
s - #342 (by @jbattermann) - Ensured that
ShouldBeEquivalentTo
will only include properties which name is an exact match - #329 dictionary.ContainKeys(..)
had a non-optionalbecause
argument and so didContainValuesAndWhich
- the later forreasonArgs
which was/is inconsistent with the rest - #333 (by @jbattermann)- Added an overload to
MonitorEvents
to monitor events for implemented interfaces or base classes only - #330 (by @gstamac)
4.1.1
Fluent Assertions 4.1.0
- Ensured that projects targeting win81 or wpa81 don't use the 'dotnet' profile (#295 and #311)
- Introduced the equivalency option
WithoutStrictOrderingFor
to specify that certain collection properties should not compared using strict ordening (#306) - Added
NotBeDecoratedWith
attribute assertion (#300) - Extended
collection.Should().Equal()
to support comparing different types of collection using a predicate (#297)
Fluent Assertions 4.0.1
Fluent Assertions 4.0.0
- Adds support for .NET 4.6, CoreCLR, .NET Native and Universal Windows Apps for Windows 10
- Removes support for Windows 8.0
- Removes v3 code that was marked as
[Obsolete]
:StringCollectionAssertions.Contains(IEnumerable<string>, string)
StringCollectionAssertions.Contains(IEnumerable<string>, IEnumerable<string>)
CollectionMemberSubjectInfo.PropertyInfo, PropertyPath, PropertyDescription
EquivalencyAssertionOptions.Empty
andDefault
which are replaced by theAssertionOptions
classIMatchingRule
, which is replaced byIMemberMatchingRule
ISelectionRule
, which is replaced byIMemberSelectionRule
ISubjectInfo
no longer has properties for getting information about properties since that was replaced with the more general member properties.SelfReferenceEquivalencyAssertionOptions
no longer has methods to include/exclude properties, but provides methods for selecting members instead.
Fluent Assertions 3.5.0
- #271 - Added a large number of assertions to verify the assembly and type structure in unit tests (piotrpMSFT)
- #200 - Added an alternative to
Which
namedSubject
- #285 - Added null-check for when
Subject
isnull
in numeric assertions (sietsevdschoot)
Fluent Assertions 3.4.1
- #282 - Fixed a stack overflow issue while determining the compile-time type … contributed by Dennis Doomen (dennisdoomen)
- #281 - Enabled the use of Including() with a nested property expression. contributed by Dennis Doomen (dennisdoomen)
Fluent Assertions 3.4.0
- #273 - Added support for recursively comparing two multi-dimensional arrays … contributed by Dennis Doomen (dennisdoomen)
- #269 - ShouldAllBeEquivalentTo/options.Including does not work as expected
- #268 - Add serialization constructor for AssertionFailedException contributed by Florian Wittmann (florianwittmann)
- #264 - Problem with BeOfType and IReadOnlyList
- #262 - Add serialization constructor for AssertionFailedException contributed by Florian Wittmann (florianwittmann)
- #261 - Resolve FailWith overload resolution when only constant-string is passed contributed by Helge Jensen (slogen)
- #260 - ShouldBeEquivalentTo does not detect difference in multi-dimensional array +enhancement
- #259 - Fixed a bug where ExcludingNestedObjects didn't work when combined with ... contributed by Dennis Doomen (dennisdoomen)
- #258 - .ShouldBeEquivalentTo() with a tree type leads to infinite loop +fix
- #253 - Ensured an enum assertion is done when the expectation is an enum during... contributed by Dennis Doomen (dennisdoomen)
- #252 - Makes EquivalencyAssertionOptionsExtentions.GetSubjectType public contributed by Adam Voss (vossad01)
- #250 - Added support for HaveFlag and NotHaveFlag contributed by Alexander Endris (AlexEndris)
- #247 - ShouldBeEquivalentTo between an Enum and Int +fix
- #246 - Use a better expression formatter
- #245 - ShouldAllBeEquivalentTo with Including still compares all properties +fix
- #244 - Changed the equivalency assertion so that comparing a collection with a ... contributed by Dennis Doomen (dennisdoomen)
- #243 - Split the
DateTime
andDateTimeOffset
assertions contributed by Dennis Doomen (dennisdoomen) - #241 - ArgumentOutOfRangeException when comparing DateTime.MaxValue or DateTime.MinValue with BeCloseTo()
- #240 - Changes the encoding of 'Build/default.ps1' to UTF-8 contributed by Adam Voss (vossad01)
- #233 - TargetInvocationException on ShouldAllBeEquivalentTo when class has IReadOnlyList property and its null +fix
- #194 - ShouldAllBeEquivalentTo and Excluding is not working properly +fix
Important
ShouldBeEquivalentTo
contained a bug that was causing false positives. If you are experiencing failing unit tests after upgrading to v3.4.0, make sure you use the IncludingAllRuntimeProperties
option to include the run-time properties and not just the ones declared.
Fluent Assertions 3.3.0
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.
Fluent Assertions 3.2
Improvements and bug-fixes
- Added an extension to fluently await an
async
method through the new Awaiting method. See the specs for some examples. - Improved the message displayed when the object upon which a structural equivalency check is done doesn't expose any properties that match the selection rules (#22).
- Corrected the behavior of equivalency assertions on arrays typed as
object
. - The equivalency check would complain about a missing interface-provided property if both subject and expectation implement the interface explicitly (#150).
- Removed de-duplication of assertion failures because it causes more confusion (#151).
- Added the possibility to include a property in the equivalency assertion based on a predicate (#154).
- Ensured that custom formatters are not overwritten by platform specific formatters and added a method to remove a custom formatter from the
Formatters
collection (#155).
Potentially breaking change
- Because of changes required for fixing #155, the
Formatters
collection is no longer directly editable. Instead, use theFormatters.AddFormatter
and 'RemoveFormatter' methods.