dupdobnightly - NFluent 3.0.0-beta-0246

NFluent is an ergonomic check library which aims to fluent your .NET TDD experience (based on simple Check.That() check statements). NFluent aims your tests to be fluent to write (with an happy 'dot' auto completion experience), fluent to read (i.e. as close as possible to plain English expression), but also fluent to troubleshoot, in a less-error-prone way comparing to the classical .NET test frameworks. NFluent is directly, but also freely, inspired by the awesome Java FEST fluent check/reflection library (http://fest.easytesting.org/).

PM> Install-Package NFluent -Version 3.0.0-beta-0246 -Source https://www.myget.org/F/dupdobnightly/api/v3/index.json

Copy to clipboard

> nuget.exe install NFluent -Version 3.0.0-beta-0246 -Source https://www.myget.org/F/dupdobnightly/api/v3/index.json

Copy to clipboard

> dotnet add package NFluent --version 3.0.0-beta-0246 --source https://www.myget.org/F/dupdobnightly/api/v3/index.json

Copy to clipboard
<PackageReference Include="NFluent" Version="3.0.0-beta-0246" />
Copy to clipboard
source https://www.myget.org/F/dupdobnightly/api/v3/index.json

nuget NFluent  ~> 3.0.0-beta-0246
Copy to clipboard

> choco install NFluent --version 3.0.0-beta-0246 --source https://www.myget.org/F/dupdobnightly/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "dupdobnightly" -SourceLocation "https://www.myget.org/F/dupdobnightly/api/v2"
Install-Module -Name "NFluent" -RequiredVersion "3.0.0-beta-0246" -Repository "dupdobnightly" -AllowPreRelease
Copy to clipboard

V 3.0.0

Major changes

  • You can execute multiple check as a single batch and get every failures, instead of the first one. This can be achieved using:

  • Check.StartBatch: stores the result of each subsequent check(s) and notifies all the errors when the returned object is disposed. Such as

`using(Check.StartBatch())

{

Check.That(sut).....

Check.That(sut)....

}`

Note that any actual exception thrown during the check phase will prevent any subsequent check from behind executed (1) and may not be reported as it may be replaced by an assertion failure exception.

This comes from C# exeption handling logic.

  • You can provide anonymous types and tuples when using IsEqualTo against any type. The check will be made against all

sut's propertie.

  • NFluent supports Net 3.5 SP1, Net. 4.5.2 +, Net Standard 2.0+. Dropped support for Net Framework 2.0, 3.0, and 4.0, as well Net Standard<2.0.

If you can't upgrade your framework version to a supported one, please use NFluent 2.7.1.

New Checks

  • Is: Checks if sut == expected. This is a strongly typed equivalent to IsEqualTo.

  • IsGreaterOrEqualThan: Checks if sut >= expected.

  • IsLessOrEqualThan: Checks if sut <= expected.

New feautres

  • You can provide custom comparer for any type, using Check.RegisterComparer like this Check.Register<MyType>(MyCustomComparer).

You can also use RegisterLocalComparer to limit its usage to a declaration scope.

Breaking changes

  • Equality logic changed for IDictionary: dictionaries are considered equals if they have the same keys and

the same values for each key. In NFluent V2, entries needed to be declared in the some order or else they were considered as different but equivalent.

  • You need to specify

  • IsAnInstanceOf<nullableType>(null) now fails (with an appropriate message). Previously, it did succeed. But,

as captured in issue #68, this behavior was triggered by a bug and kept due to a poor error message when fixed.

  • The IStructCheck<T> interface has been removed as well as associated extensibility helper. Those were dedicated

to value types, you can migrate your existing extensions to the ICheck<T> type instead. Please open an issue if

you need help.

Fixes

  • HasFieldWithSameValues resulted in false positive when string fields had the same value.

  • IsNotEqualTo now properly preserves expected type

  • Improved rerporting of differences for enumerations and dictionaries to make them more consistent and fixed some inaccuracies.

GitHub Issues

  • #325, #327, #330, #332

Obsolete

Marked as obsolet

  • ThatAsynCode: you can now use ThatCode even for async methods.

Here is the list of methods, classes and other obsolete stuff that have been removed in this version as well

as workaround advices.

  • Drop support for Net 2.0 and 3.0: keep using NFluent V2.x versions if you support for these.

  • Check.ThatEnumhas been removed. You must use Check.That instead.

  • ILambdaCheck: the definition was kept to prevent breaking build, but it was no longer used. If this is a

problem for you, open an issue

  • IsPositive (available for numbers): please use IsStrictlyPositive instead.

  • IsNegative (available for numbers): please use IsStrictlyNegative instead.

  • IsLessThan (available for numbers): please use IsStrictlyNegative instead.

  • IsGreaterThan (available for numbers): please use IsStrictlyGreaterThan instead.

  • IsSameReferenceThan: please use IsSameReferenceAs instead.

  • HasFieldsEqualToThose: please use HasFieldsWithSameValues instead.

  • HasFieldsNotEqualToThose: please use HasNotFieldsWithSameValues instead.

  • IsAFaillingCheckWithMessage: please use IsAFailingCheckWithMessage instead.

  • IsAFaillingCheck: please use IsAFailingCheck instead.

  • Properties (available for enumeration): please use Extracting instead.

  • Checker.BuildLinkWhich (used for custom extension): please use ExtensibilityHelper.BuildCheckLinkWhich instead.

  • Checker.ExecuteCheckAndProvideSubItem (used for custom extension): please 'ExtensibilityHelper' static class methods instead.

V 2.7.1

Fixes

  • HasFieldsWithSameValues failed to properly compare when the expected value contained duplicate string.

More generally, instances where only checked once for equality; any subsequent check was assumed to be succesful.

This could lead to false positive (i.e. checks succeeded when it should have failed).

This regression was introduced by V 2.2.0 in 02/2018. Sorry about that.

GitHub Issues

  • #331
  • .NETStandard 2.0
  • .NETFramework 4.6
  • .NETFramework 3.5
  • .NETFramework 3.5: 3.5.0.0
  • .NETFramework 4.6: 4.6.0.0
  • .NETStandard 2.0: 2.0.0.0

Owners

Dupdob

Authors

Thomas PIERRAIN, Cyrille DUPUYDAUBY, Rui CARVALHO, Marc-Antoine LATOUR

Project URL

http://www.n-fluent.net/

License

Apache-2.0

Tags

tdd bdd test fluent check checks easy nunit xunit mbunit mstestsucks

Info

263 total downloads
21 downloads for version 3.0.0-beta-0246
Download (640.28 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
3.0.0-beta-0250 634.56 KB Fri, 04 Feb 2022 15:10:23 GMT 23
3.0.0-beta-0246 640.28 KB Wed, 13 Oct 2021 10:03:19 GMT 21
3.0.0-beta-0245 638.54 KB Mon, 11 Oct 2021 21:43:04 GMT 5
3.0.0-beta-0244 638.07 KB Mon, 11 Oct 2021 13:07:00 GMT 3
3.0.0-beta-0241 628.11 KB Tue, 22 Jun 2021 07:44:49 GMT 2
3.0.0-beta-0238 774.62 KB Tue, 16 Feb 2021 21:16:51 GMT 64
3.0.0-beta-0237 773.02 KB Sat, 13 Feb 2021 15:06:07 GMT 5
3.0.0-beta-0236 764.76 KB Sun, 24 Jan 2021 15:23:35 GMT 5
3.0.0-beta-0223 764.58 KB Wed, 16 Dec 2020 21:28:20 GMT 3
3.0.0-beta-0222 761.9 KB Thu, 22 Oct 2020 07:46:33 GMT 7
3.0.0-beta-0220 761.89 KB Wed, 14 Oct 2020 07:22:28 GMT 21
3.0.0-beta-0216 761.89 KB Tue, 13 Oct 2020 13:59:47 GMT 20
3.0.0-beta-0214 756.99 KB Thu, 23 Jul 2020 07:02:28 GMT 4
2.7.0-beta-0213 1.44 MB Wed, 29 Jan 2020 06:07:43 GMT 19
2.6.0-beta-0197 1.3 MB Fri, 03 May 2019 07:05:26 GMT 3
2.5.1-beta-0194 1.24 MB Fri, 22 Mar 2019 21:38:54 GMT 5
2.4.0-beta-0187 881.53 KB Thu, 06 Sep 2018 20:18:31 GMT 5
2.4.0-beta-0186 881.49 KB Thu, 06 Sep 2018 12:51:55 GMT 5
2.4.0-beta-0183 760.05 KB Thu, 19 Jul 2018 15:57:18 GMT 21
2.4.0-beta-0182 758.11 KB Wed, 18 Jul 2018 13:18:25 GMT 22