EAXUnitHelpers.Comparison
6.0.0
See the version list below for details.
dotnet add package EAXUnitHelpers.Comparison --version 6.0.0
NuGet\Install-Package EAXUnitHelpers.Comparison -Version 6.0.0
<PackageReference Include="EAXUnitHelpers.Comparison" Version="6.0.0" />
paket add EAXUnitHelpers.Comparison --version 6.0.0
#r "nuget: EAXUnitHelpers.Comparison, 6.0.0"
// Install EAXUnitHelpers.Comparison as a Cake Addin #addin nuget:?package=EAXUnitHelpers.Comparison&version=6.0.0 // Install EAXUnitHelpers.Comparison as a Cake Tool #tool nuget:?package=EAXUnitHelpers.Comparison&version=6.0.0
EAXUnitHelpers.Comparison
This package contains custom comparators for objects and enumerables. The following uses are supported:
Assert.Equal(expected, actual, new CustomObjectComparer<MySpecialObject>())
Assert.Equal(expected, actual, new CustomEnumerableComparer<MySpecialObject>())
Assert.Equal(expected, actual, new CustomObjectComparer<MySpecialObject>(true))
Assert.Equal(expected, actual, new CustomEnumerableComparer<MySpecialObject>(true))
Assert.Equal(expected, actual, new CustomObjectComparer<MySpecialObject>(new List<string> {"Name", "City"}))
Assert.Equal(expected, actual, new CustomEnumerableComparer<MySpecialObject>(new List<string> {"Name", "City"}))
Assert.Equal(expected, actual, new CustomObjectComparer<MySpecialObject>(true, new List<string> {"Name", "City"}))
Assert.Equal(expected, actual, new CustomEnumerableComparer<MySpecialObject>(true, new List<string> {"Name", "City"}))
CustomObjectComparer should be used when two objects need to be compared (which should be obvious) and CustomEnumerableComparer should be used when two enumerables (IEnumerable, List, array, etc.) should be compared (which, again, should be obvious).
Passing true to the constructor of either CustomObjectComparer or CustomEnumerableComparer will result in the comparison checking inherited properties as well.
Passing a list of properties will restrict the comparison of the objects to those properties passed. This is case sensitive so if you want to check the "Name" then you must pass "Name" and not "name".
The contents of this package are based on an answer to a question on this topic on StackOverflow, which can be found here.
To build the NuGet package, navigate to the solution directory and run: dotnet pack ./src/EAXUnitHelpers.Comparison/EAXUnitHelpers.Comparison.csproj -o ./ -c Release
Use NuGet.org's UI to upload the generated package.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- EAExtensions.PropertyInfoExtensions (>= 0.0.2)
- EAExtensions.TypeExtensions (>= 0.0.4)
- xunit (>= 2.4.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.