From eca2d43024e0f7771fad9efb693bbb0abba964d4 Mon Sep 17 00:00:00 2001 From: Dennis Doomen Date: Fri, 10 Nov 2023 19:44:00 +0100 Subject: [PATCH] Update package references, refactor code, and fix namespace Updated the package references in the csproj files. Refactored the code in several files to improve readability and maintainability. Also, fixed the namespace in the DataTableAssertionExtensions and DataRowAssertionExtensions classes to align with standard conventions. No functional changes were made. --- .editorconfig | 4 +-- Build/_build.csproj | 4 +-- Directory.Build.props | 8 +++--- README.md | 16 ++++++------ .../ReadOnlyNonGenericCollectionWrapper.cs | 1 - ...DataColumnCollectionAssertionExtensions.cs | 1 - .../DataEquivalencyAssertionOptions.cs | 13 +++------- .../DataRowAssertionExtensions.cs | 1 + .../DataRowCollectionAssertionExtensions.cs | 1 - .../DataTableAssertionExtensions.cs | 2 ++ .../DataTableAssertions.cs | 3 +-- .../DataTableCollectionAssertionExtensions.cs | 1 - .../Equivalency/DataColumnEquivalencyStep.cs | 3 +-- .../DataRelationEquivalencyStep.cs | 3 +-- .../DataRowCollectionEquivalencyStep.cs | 7 +---- .../Equivalency/DataRowEquivalencyStep.cs | 3 +-- .../Equivalency/DataTableEquivalencyStep.cs | 3 +-- .../EquivalencyAssertionOptionsExtensions.cs | 1 - .../FluentAssertions.DataSets.csproj | 4 +-- Src/FluentAssertions.DataSets/RowMatchMode.cs | 2 +- Tests/Approval.Tests/ApiApproval.cs | 2 +- Tests/Approval.Tests/Approval.Tests.csproj | 10 +++---- .../net47.verified.txt | 26 +++++++++---------- .../net6.0.verified.txt | 26 +++++++++---------- Tests/Benchmarks/Benchmarks.csproj | 2 +- Tests/Benchmarks/LargeDataTableEquivalency.cs | 1 + .../DataSpecs.cs | 2 +- .../FluentAssertions.DataSets.Specs.csproj | 10 +++---- nuget.config | 1 - 29 files changed, 69 insertions(+), 92 deletions(-) diff --git a/.editorconfig b/.editorconfig index 8da38cb..ebae102 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -root = true + root = true # EditorConfig is awesome: http://EditorConfig.org # top-most EditorConfig file @@ -172,7 +172,7 @@ dotnet_diagnostic.RS0030.severity = error dotnet_diagnostic.IDE0004.severity = error # IDE0005: Remove unnecessary usings/imports -dotnet_diagnostic.IDE0005.severity = suggestion +dotnet_diagnostic.IDE0005.severity = error # IDE0051: Remove unused private members (no reads or writes) dotnet_diagnostic.IDE0051.severity = error diff --git a/Build/_build.csproj b/Build/_build.csproj index 257be1d..b7b64e4 100644 --- a/Build/_build.csproj +++ b/Build/_build.csproj @@ -23,8 +23,8 @@ - - + + diff --git a/Directory.Build.props b/Directory.Build.props index fcab843..ad74a50 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,7 +13,7 @@ true - latest + 7.0 All true @@ -26,15 +26,15 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/README.md b/README.md index 0149492..694aa31 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,18 @@ [![Coveralls branch](https://img.shields.io/coverallsCoverage/github/fluentassertions/fluentassertions.datasets?branch=develop)](https://coveralls.io/github/fluentassertions/fluentassertions.datasets?branch=develop) [![](https://img.shields.io/github/release/FluentAssertions.Datasets/FluentAssertions.Datasets.svg?label=latest%20release&color=007edf)](https://github.com/FluentAssertions/FluentAssertions.DataSets/releases/latest) [![](https://img.shields.io/nuget/dt/FluentAssertions.DataSets.svg?label=downloads&color=007edf&logo=nuget)](https://www.nuget.org/packages/FluentAssertions.DataSets) -[![](https://img.shields.io/librariesio/dependents/nuget/FluentAssertions.DataSets.svg?label=dependent%20libraries)](https://libraries.io/nuget/FluentAssertions.Data) +[![](https://img.shields.io/librariesio/dependents/nuget/FluentAssertions.DataSets.svg?label=dependent%20libraries)](https://libraries.io/nuget/FluentAssertions.DataSets) [![GitHub Repo stars](https://img.shields.io/github/stars/fluentassertions/fluentassertions.datasets)](https://github.com/fluentassertions/fluentassertions.datasets/stargazers) [![GitHub contributors](https://img.shields.io/github/contributors/fluentassertions/fluentassertions.datasets)](https://github.com/fluentassertions/fluentassertions.datasets/graphs/contributors) -[![GitHub last commit](https://img.shields.io/github/last-commit/fluentassertions/fluentassertions.datasets)](https://github.com/fluentassertions/fluentassertions.data) -[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/fluentassertions/fluentassertions.data)](https://github.com/fluentassertions/fluentassertions.data/graphs/commit-activity) -[![open issues](https://img.shields.io/github/issues/fluentassertions/fluentassertions.data)](https://github.com/fluentassertions/fluentassertions.data/issues) +[![GitHub last commit](https://img.shields.io/github/last-commit/fluentassertions/fluentassertions.datasets)](https://github.com/fluentassertions/fluentassertions.datasets) +[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/fluentassertions/fluentassertions.datasets)](https://github.com/fluentassertions/fluentassertions.data/graphs/commit-activity) +[![open issues](https://img.shields.io/github/issues/fluentassertions/fluentassertions.datasets)](https://github.com/fluentassertions/fluentassertions.datasets/issues) ![](https://img.shields.io/badge/release%20strategy-githubflow-orange.svg) Extends https://www.fluentassertions.com with specialized assertions for dealing with `DataSet`, `DataTable`, `DataRow` and `DataColumn` > [!WARNING] -> This set of extensions was extracted from Fluent Assertions 6 and is in maintenance mode. Pull Requests will still be accepted, but we will not actively work on improvements or bugs. +> This set of extensions was extracted from Fluent Assertions 6 and is in maintenance mode. Pull Requests will still be accepted, but we will not actively work on improvements or bugs. # Information * Uses [Semantic Versioning](https://semver.org/lang/nl/) @@ -24,7 +24,7 @@ Extends https://www.fluentassertions.com with specialized assertions for dealing # Installation -This package is shipped as a [NuGet package](https://www.nuget.org/packages/FluentAssertions.Data) and can be installed through the CLI using: +This package is shipped as a [NuGet package](https://www.nuget.org/packages/FluentAssertions.DataSets) and can be installed through the CLI using: dotnet add package FluentAssertions.DataSets @@ -33,8 +33,8 @@ This package is shipped as a [NuGet package](https://www.nuget.org/packages/Flue ## Prerequisites * Visual Studio 2022 or JetBrains Rider 2021.3 -* Build Tools 2022 (including the Universal Windows Platform build tools). -* .NET Framework 4.7 SDK +* Build Tools 2022 (including the Universal Windows Platform build tools). +* .NET Framework 4.7 SDK * .NET 7.0 SDK installed. Check the `global.json`` for the current minimum required version. ## Building diff --git a/Src/FluentAssertions.DataSets/Common/ReadOnlyNonGenericCollectionWrapper.cs b/Src/FluentAssertions.DataSets/Common/ReadOnlyNonGenericCollectionWrapper.cs index 45c1e7b..11c43ab 100644 --- a/Src/FluentAssertions.DataSets/Common/ReadOnlyNonGenericCollectionWrapper.cs +++ b/Src/FluentAssertions.DataSets/Common/ReadOnlyNonGenericCollectionWrapper.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Data; using System.Linq; -using FluentAssertions.Common; namespace FluentAssertions.DataSets.Common; diff --git a/Src/FluentAssertions.DataSets/DataColumnCollectionAssertionExtensions.cs b/Src/FluentAssertions.DataSets/DataColumnCollectionAssertionExtensions.cs index 326c9d2..99086fa 100644 --- a/Src/FluentAssertions.DataSets/DataColumnCollectionAssertionExtensions.cs +++ b/Src/FluentAssertions.DataSets/DataColumnCollectionAssertionExtensions.cs @@ -2,7 +2,6 @@ using System.Data; using System.Linq; using FluentAssertions.Collections; -using FluentAssertions.Common; using FluentAssertions.DataSets.Common; using FluentAssertions.Execution; diff --git a/Src/FluentAssertions.DataSets/DataEquivalencyAssertionOptions.cs b/Src/FluentAssertions.DataSets/DataEquivalencyAssertionOptions.cs index 3f86676..4eb482f 100644 --- a/Src/FluentAssertions.DataSets/DataEquivalencyAssertionOptions.cs +++ b/Src/FluentAssertions.DataSets/DataEquivalencyAssertionOptions.cs @@ -3,7 +3,6 @@ using System.Data; using System.Linq.Expressions; using System.Reflection; -using FluentAssertions.DataSets.Equivalency; using FluentAssertions.Equivalency; namespace FluentAssertions.DataSets; @@ -127,8 +126,7 @@ private void ExcludeMemberOfSubtypeOfRelatedTypeByGeneratedPredicate excludeColumnsForTable) - && excludeColumnsForTable.Contains(column.ColumnName)) - { - return true; - } - - return false; + return excludeColumnNamesByTableName.TryGetValue(column.Table.TableName, out HashSet excludeColumnsForTable) + && excludeColumnsForTable.Contains(column.ColumnName); } } diff --git a/Src/FluentAssertions.DataSets/DataRowAssertionExtensions.cs b/Src/FluentAssertions.DataSets/DataRowAssertionExtensions.cs index 0c6c629..af98bd3 100644 --- a/Src/FluentAssertions.DataSets/DataRowAssertionExtensions.cs +++ b/Src/FluentAssertions.DataSets/DataRowAssertionExtensions.cs @@ -3,6 +3,7 @@ using FluentAssertions.DataSets; using JetBrains.Annotations; +// ReSharper disable once CheckNamespace namespace FluentAssertions; /// diff --git a/Src/FluentAssertions.DataSets/DataRowCollectionAssertionExtensions.cs b/Src/FluentAssertions.DataSets/DataRowCollectionAssertionExtensions.cs index 5b72dc8..9638b90 100644 --- a/Src/FluentAssertions.DataSets/DataRowCollectionAssertionExtensions.cs +++ b/Src/FluentAssertions.DataSets/DataRowCollectionAssertionExtensions.cs @@ -2,7 +2,6 @@ using System.Data; using System.Linq; using FluentAssertions.Collections; -using FluentAssertions.Common; using FluentAssertions.DataSets.Common; using FluentAssertions.Execution; diff --git a/Src/FluentAssertions.DataSets/DataTableAssertionExtensions.cs b/Src/FluentAssertions.DataSets/DataTableAssertionExtensions.cs index f6ed214..b4e080c 100644 --- a/Src/FluentAssertions.DataSets/DataTableAssertionExtensions.cs +++ b/Src/FluentAssertions.DataSets/DataTableAssertionExtensions.cs @@ -1,7 +1,9 @@ using System.Data; using System.Diagnostics; +using FluentAssertions.DataSets; using JetBrains.Annotations; +// ReSharper disable once CheckNamespace namespace FluentAssertions; /// diff --git a/Src/FluentAssertions.DataSets/DataTableAssertions.cs b/Src/FluentAssertions.DataSets/DataTableAssertions.cs index f075a01..80a8fda 100644 --- a/Src/FluentAssertions.DataSets/DataTableAssertions.cs +++ b/Src/FluentAssertions.DataSets/DataTableAssertions.cs @@ -3,13 +3,12 @@ using System.Data; using System.Diagnostics; using System.Linq; -using FluentAssertions.DataSets; using FluentAssertions.DataSets.Common; using FluentAssertions.Equivalency; using FluentAssertions.Execution; using FluentAssertions.Primitives; -namespace FluentAssertions; +namespace FluentAssertions.DataSets; /// /// Provides convenient assertion methods on a that can be diff --git a/Src/FluentAssertions.DataSets/DataTableCollectionAssertionExtensions.cs b/Src/FluentAssertions.DataSets/DataTableCollectionAssertionExtensions.cs index e2a2798..592f537 100644 --- a/Src/FluentAssertions.DataSets/DataTableCollectionAssertionExtensions.cs +++ b/Src/FluentAssertions.DataSets/DataTableCollectionAssertionExtensions.cs @@ -2,7 +2,6 @@ using System.Data; using System.Linq; using FluentAssertions.Collections; -using FluentAssertions.Common; using FluentAssertions.DataSets.Common; using FluentAssertions.Execution; diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataColumnEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataColumnEquivalencyStep.cs index a67f00c..b19366d 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataColumnEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataColumnEquivalencyStep.cs @@ -14,9 +14,8 @@ protected override EquivalencyResult OnHandle(Comparands comparands, IEquivalenc IEquivalencyValidator nestedValidator) { var subject = comparands.Subject as DataColumn; - var expectation = comparands.Expectation as DataColumn; - if (expectation is null) + if (comparands.Expectation is not DataColumn expectation) { if (subject is not null) { diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataRelationEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataRelationEquivalencyStep.cs index 84578cc..8d1e2a7 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataRelationEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataRelationEquivalencyStep.cs @@ -15,9 +15,8 @@ protected override EquivalencyResult OnHandle(Comparands comparands, IEquivalenc IEquivalencyValidator nestedValidator) { var subject = comparands.Subject as DataRelation; - var expectation = comparands.Expectation as DataRelation; - if (expectation is null) + if (comparands.Expectation is not DataRelation expectation) { if (subject is not null) { diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataRowCollectionEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataRowCollectionEquivalencyStep.cs index 9441404..d9701bc 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataRowCollectionEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataRowCollectionEquivalencyStep.cs @@ -201,12 +201,7 @@ public bool Equals(CompoundKey other) return false; } - if (values.Length != other.values.Length) - { - return false; - } - - return values.SequenceEqual(other.values); + return values.Length == other.values.Length && values.SequenceEqual(other.values); } public override bool Equals(object obj) => Equals(obj as CompoundKey); diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataRowEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataRowEquivalencyStep.cs index 913c1aa..8c20727 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataRowEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataRowEquivalencyStep.cs @@ -16,9 +16,8 @@ protected override EquivalencyResult OnHandle(Comparands comparands, IEquivalenc IEquivalencyValidator nestedValidator) { var subject = comparands.Subject as DataRow; - var expectation = comparands.Expectation as DataRow; - if (expectation is null) + if (comparands.Expectation is not DataRow expectation) { if (subject is not null) { diff --git a/Src/FluentAssertions.DataSets/Equivalency/DataTableEquivalencyStep.cs b/Src/FluentAssertions.DataSets/Equivalency/DataTableEquivalencyStep.cs index d0076a8..5087ea4 100644 --- a/Src/FluentAssertions.DataSets/Equivalency/DataTableEquivalencyStep.cs +++ b/Src/FluentAssertions.DataSets/Equivalency/DataTableEquivalencyStep.cs @@ -14,9 +14,8 @@ protected override EquivalencyResult OnHandle(Comparands comparands, IEquivalenc IEquivalencyValidator nestedValidator) { var subject = comparands.Subject as DataTable; - var expectation = comparands.Expectation as DataTable; - if (expectation is null) + if (comparands.Expectation is not DataTable expectation) { if (subject is not null) { diff --git a/Src/FluentAssertions.DataSets/EquivalencyAssertionOptionsExtensions.cs b/Src/FluentAssertions.DataSets/EquivalencyAssertionOptionsExtensions.cs index 862ddb1..300707a 100644 --- a/Src/FluentAssertions.DataSets/EquivalencyAssertionOptionsExtensions.cs +++ b/Src/FluentAssertions.DataSets/EquivalencyAssertionOptionsExtensions.cs @@ -2,7 +2,6 @@ using System.Linq; using FluentAssertions.DataSets.Equivalency; using FluentAssertions.Equivalency.Steps; -using FluentAssertions.Xml; namespace FluentAssertions.DataSets; diff --git a/Src/FluentAssertions.DataSets/FluentAssertions.DataSets.csproj b/Src/FluentAssertions.DataSets/FluentAssertions.DataSets.csproj index 5ed5d95..d6fac17 100644 --- a/Src/FluentAssertions.DataSets/FluentAssertions.DataSets.csproj +++ b/Src/FluentAssertions.DataSets/FluentAssertions.DataSets.csproj @@ -14,7 +14,7 @@ - Dennis Doomen;Jonas Nyrup + Dennis Doomen;Jonathan Gilbert Extensions to Fluent Assertions for dealing with DataSets and DataTables. @@ -59,7 +59,7 @@ contentFiles\any\any\ - + diff --git a/Src/FluentAssertions.DataSets/RowMatchMode.cs b/Src/FluentAssertions.DataSets/RowMatchMode.cs index c309884..e37cf35 100644 --- a/Src/FluentAssertions.DataSets/RowMatchMode.cs +++ b/Src/FluentAssertions.DataSets/RowMatchMode.cs @@ -20,5 +20,5 @@ public enum RowMatchMode /// objects with exactly equivalent /// configuration. /// - PrimaryKey, + PrimaryKey } diff --git a/Tests/Approval.Tests/ApiApproval.cs b/Tests/Approval.Tests/ApiApproval.cs index 8d98b63..005ce05 100644 --- a/Tests/Approval.Tests/ApiApproval.cs +++ b/Tests/Approval.Tests/ApiApproval.cs @@ -50,7 +50,7 @@ public Task ApproveApi(string frameworkVersion) private static string GetSourceDirectory([CallerFilePath] string path = "") => Path.GetDirectoryName(path); // Copied from https://github.com/VerifyTests/Verify.DiffPlex/blob/master/src/Verify.DiffPlex/VerifyDiffPlex.cs - public static Task OnlyIncludeChanges(string received, string verified, IReadOnlyDictionary _) + private static Task OnlyIncludeChanges(string received, string verified, IReadOnlyDictionary _) { var diff = InlineDiffBuilder.Diff(verified, received); diff --git a/Tests/Approval.Tests/Approval.Tests.csproj b/Tests/Approval.Tests/Approval.Tests.csproj index 5f12353..54639d6 100644 --- a/Tests/Approval.Tests/Approval.Tests.csproj +++ b/Tests/Approval.Tests/Approval.Tests.csproj @@ -6,15 +6,15 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net47.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net47.verified.txt index 19b930a..585c331 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net47.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net47.verified.txt @@ -37,21 +37,9 @@ namespace FluentAssertions } public static class DataTableAssertionExtensions { - public static FluentAssertions.DataTableAssertions Should(this TDataTable actualValue) + public static FluentAssertions.DataSets.DataTableAssertions Should(this TDataTable actualValue) where TDataTable : System.Data.DataTable { } } - public class DataTableAssertions : FluentAssertions.Primitives.ReferenceTypeAssertions> - where TDataTable : System.Data.DataTable - { - public DataTableAssertions(TDataTable dataTable) { } - protected override string Identifier { get; } - public FluentAssertions.AndConstraint> BeEquivalentTo(System.Data.DataTable expectation, string because = "", params object[] becauseArgs) { } - public FluentAssertions.AndConstraint> BeEquivalentTo(System.Data.DataTable expectation, System.Func, FluentAssertions.DataSets.IDataEquivalencyAssertionOptions> config, string because = "", params object[] becauseArgs) { } - public FluentAssertions.AndWhichConstraint, System.Data.DataColumn> HaveColumn(string expectedColumnName, string because = "", params object[] becauseArgs) { } - public FluentAssertions.AndConstraint> HaveColumns(params string[] expectedColumnNames) { } - public FluentAssertions.AndConstraint> HaveColumns(System.Collections.Generic.IEnumerable expectedColumnNames, string because = "", params object[] becauseArgs) { } - public FluentAssertions.AndConstraint> HaveRowCount(int expected, string because = "", params object[] becauseArgs) { } - } public static class DataTableCollectionAssertionExtensions { public static FluentAssertions.AndConstraint> BeSameAs(this FluentAssertions.Collections.GenericCollectionAssertions assertion, System.Data.DataTableCollection expected, string because = "", params object[] becauseArgs) { } @@ -102,6 +90,18 @@ namespace FluentAssertions.DataSets public FluentAssertions.AndConstraint> HaveTables(params string[] expectedTableNames) { } public FluentAssertions.AndConstraint> HaveTables(System.Collections.Generic.IEnumerable expectedTableNames, string because = "", params object[] becauseArgs) { } } + public class DataTableAssertions : FluentAssertions.Primitives.ReferenceTypeAssertions> + where TDataTable : System.Data.DataTable + { + public DataTableAssertions(TDataTable dataTable) { } + protected override string Identifier { get; } + public FluentAssertions.AndConstraint> BeEquivalentTo(System.Data.DataTable expectation, string because = "", params object[] becauseArgs) { } + public FluentAssertions.AndConstraint> BeEquivalentTo(System.Data.DataTable expectation, System.Func, FluentAssertions.DataSets.IDataEquivalencyAssertionOptions> config, string because = "", params object[] becauseArgs) { } + public FluentAssertions.AndWhichConstraint, System.Data.DataColumn> HaveColumn(string expectedColumnName, string because = "", params object[] becauseArgs) { } + public FluentAssertions.AndConstraint> HaveColumns(params string[] expectedColumnNames) { } + public FluentAssertions.AndConstraint> HaveColumns(System.Collections.Generic.IEnumerable expectedColumnNames, string because = "", params object[] becauseArgs) { } + public FluentAssertions.AndConstraint> HaveRowCount(int expected, string because = "", params object[] becauseArgs) { } + } public static class EquivalencyAssertionOptionsExtensions { public static void AddDataSetSupport(this FluentAssertions.EquivalencyPlan plan) { } diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net6.0.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net6.0.verified.txt index 19b930a..585c331 100644 --- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net6.0.verified.txt +++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.DataSets/net6.0.verified.txt @@ -37,21 +37,9 @@ namespace FluentAssertions } public static class DataTableAssertionExtensions { - public static FluentAssertions.DataTableAssertions Should(this TDataTable actualValue) + public static FluentAssertions.DataSets.DataTableAssertions Should(this TDataTable actualValue) where TDataTable : System.Data.DataTable { } } - public class DataTableAssertions : FluentAssertions.Primitives.ReferenceTypeAssertions> - where TDataTable : System.Data.DataTable - { - public DataTableAssertions(TDataTable dataTable) { } - protected override string Identifier { get; } - public FluentAssertions.AndConstraint> BeEquivalentTo(System.Data.DataTable expectation, string because = "", params object[] becauseArgs) { } - public FluentAssertions.AndConstraint> BeEquivalentTo(System.Data.DataTable expectation, System.Func, FluentAssertions.DataSets.IDataEquivalencyAssertionOptions> config, string because = "", params object[] becauseArgs) { } - public FluentAssertions.AndWhichConstraint, System.Data.DataColumn> HaveColumn(string expectedColumnName, string because = "", params object[] becauseArgs) { } - public FluentAssertions.AndConstraint> HaveColumns(params string[] expectedColumnNames) { } - public FluentAssertions.AndConstraint> HaveColumns(System.Collections.Generic.IEnumerable expectedColumnNames, string because = "", params object[] becauseArgs) { } - public FluentAssertions.AndConstraint> HaveRowCount(int expected, string because = "", params object[] becauseArgs) { } - } public static class DataTableCollectionAssertionExtensions { public static FluentAssertions.AndConstraint> BeSameAs(this FluentAssertions.Collections.GenericCollectionAssertions assertion, System.Data.DataTableCollection expected, string because = "", params object[] becauseArgs) { } @@ -102,6 +90,18 @@ namespace FluentAssertions.DataSets public FluentAssertions.AndConstraint> HaveTables(params string[] expectedTableNames) { } public FluentAssertions.AndConstraint> HaveTables(System.Collections.Generic.IEnumerable expectedTableNames, string because = "", params object[] becauseArgs) { } } + public class DataTableAssertions : FluentAssertions.Primitives.ReferenceTypeAssertions> + where TDataTable : System.Data.DataTable + { + public DataTableAssertions(TDataTable dataTable) { } + protected override string Identifier { get; } + public FluentAssertions.AndConstraint> BeEquivalentTo(System.Data.DataTable expectation, string because = "", params object[] becauseArgs) { } + public FluentAssertions.AndConstraint> BeEquivalentTo(System.Data.DataTable expectation, System.Func, FluentAssertions.DataSets.IDataEquivalencyAssertionOptions> config, string because = "", params object[] becauseArgs) { } + public FluentAssertions.AndWhichConstraint, System.Data.DataColumn> HaveColumn(string expectedColumnName, string because = "", params object[] becauseArgs) { } + public FluentAssertions.AndConstraint> HaveColumns(params string[] expectedColumnNames) { } + public FluentAssertions.AndConstraint> HaveColumns(System.Collections.Generic.IEnumerable expectedColumnNames, string because = "", params object[] becauseArgs) { } + public FluentAssertions.AndConstraint> HaveRowCount(int expected, string because = "", params object[] becauseArgs) { } + } public static class EquivalencyAssertionOptionsExtensions { public static void AddDataSetSupport(this FluentAssertions.EquivalencyPlan plan) { } diff --git a/Tests/Benchmarks/Benchmarks.csproj b/Tests/Benchmarks/Benchmarks.csproj index a295160..e3c4975 100644 --- a/Tests/Benchmarks/Benchmarks.csproj +++ b/Tests/Benchmarks/Benchmarks.csproj @@ -6,7 +6,7 @@ Exe - + diff --git a/Tests/Benchmarks/LargeDataTableEquivalency.cs b/Tests/Benchmarks/LargeDataTableEquivalency.cs index 20ee801..bfae8d5 100644 --- a/Tests/Benchmarks/LargeDataTableEquivalency.cs +++ b/Tests/Benchmarks/LargeDataTableEquivalency.cs @@ -4,6 +4,7 @@ using BenchmarkDotNet.Attributes; using Bogus; using FluentAssertions; +using FluentAssertions.DataSets; namespace Benchmarks; diff --git a/Tests/FluentAssertions.DataSets.Specs/DataSpecs.cs b/Tests/FluentAssertions.DataSets.Specs/DataSpecs.cs index 5353e12..1f2f86e 100644 --- a/Tests/FluentAssertions.DataSets.Specs/DataSpecs.cs +++ b/Tests/FluentAssertions.DataSets.Specs/DataSpecs.cs @@ -408,7 +408,7 @@ public TypedDataSetSubclass(TypedDataSet copyFrom, bool swapTableOrder = false, } } - private void CopyTable(TDataTable from, TDataTable to, bool randomizeRowOrder) + private static void CopyTable(TDataTable from, TDataTable to, bool randomizeRowOrder) where TDataTable : DataTable, IEnumerable where TDataRow : DataRow { diff --git a/Tests/FluentAssertions.DataSets.Specs/FluentAssertions.DataSets.Specs.csproj b/Tests/FluentAssertions.DataSets.Specs/FluentAssertions.DataSets.Specs.csproj index cb06e37..1357390 100644 --- a/Tests/FluentAssertions.DataSets.Specs/FluentAssertions.DataSets.Specs.csproj +++ b/Tests/FluentAssertions.DataSets.Specs/FluentAssertions.DataSets.Specs.csproj @@ -22,22 +22,18 @@ Upgrading to 1.6.0 gives "Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0" --> - - all - runtime; build; native; contentfiles; analyzers - - - + + all runtime; build; native; contentfiles; analyzers - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/nuget.config b/nuget.config index dbed221..80f5bd7 100644 --- a/nuget.config +++ b/nuget.config @@ -2,7 +2,6 @@ -