From b68fba9affd3a709fa4a50611ce4904d85c87a30 Mon Sep 17 00:00:00 2001 From: Jonas Nyrup Date: Fri, 27 Dec 2024 12:03:46 +0100 Subject: [PATCH 1/4] Simplify build dependencies --- Build/_build.csproj | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Build/_build.csproj b/Build/_build.csproj index b7b64e4..bfe414e 100644 --- a/Build/_build.csproj +++ b/Build/_build.csproj @@ -7,24 +7,12 @@ ..\ ..\ - - OS_WINDOWS - - - OS_LINUX - - - OS_MAC - - - - From c9ed5b5beef336934594fc4ec38d8e059b38a7ce Mon Sep 17 00:00:00 2001 From: Jonas Nyrup Date: Fri, 27 Dec 2024 12:03:59 +0100 Subject: [PATCH 2/4] Remove unused usings --- Src/FluentAssertions.DataSets/DataRowAssertions.cs | 1 - Src/FluentAssertions.DataSets/DataTableAssertions.cs | 1 - .../DataTableCollectionAssertionExtensions.cs | 1 - 3 files changed, 3 deletions(-) diff --git a/Src/FluentAssertions.DataSets/DataRowAssertions.cs b/Src/FluentAssertions.DataSets/DataRowAssertions.cs index 94e49ae..d96263d 100644 --- a/Src/FluentAssertions.DataSets/DataRowAssertions.cs +++ b/Src/FluentAssertions.DataSets/DataRowAssertions.cs @@ -4,7 +4,6 @@ using System.Diagnostics; using System.Linq; using FluentAssertions.DataSets.Common; -using FluentAssertions.Equivalency; using FluentAssertions.Execution; using FluentAssertions.Primitives; diff --git a/Src/FluentAssertions.DataSets/DataTableAssertions.cs b/Src/FluentAssertions.DataSets/DataTableAssertions.cs index 134e979..d64276f 100644 --- a/Src/FluentAssertions.DataSets/DataTableAssertions.cs +++ b/Src/FluentAssertions.DataSets/DataTableAssertions.cs @@ -4,7 +4,6 @@ using System.Diagnostics; using System.Linq; using FluentAssertions.DataSets.Common; -using FluentAssertions.Equivalency; using FluentAssertions.Execution; using FluentAssertions.Primitives; diff --git a/Src/FluentAssertions.DataSets/DataTableCollectionAssertionExtensions.cs b/Src/FluentAssertions.DataSets/DataTableCollectionAssertionExtensions.cs index ccaaad5..4dd0d70 100644 --- a/Src/FluentAssertions.DataSets/DataTableCollectionAssertionExtensions.cs +++ b/Src/FluentAssertions.DataSets/DataTableCollectionAssertionExtensions.cs @@ -4,7 +4,6 @@ using FluentAssertions.Collections; using FluentAssertions.DataSets; using FluentAssertions.DataSets.Common; -using FluentAssertions.Execution; // ReSharper disable once CheckNamespace namespace FluentAssertions; From a83bc56cfe571b6899863ae23d1515990d022839 Mon Sep 17 00:00:00 2001 From: Jonas Nyrup Date: Fri, 27 Dec 2024 12:26:20 +0100 Subject: [PATCH 3/4] Use discard --- Tests/FluentAssertions.DataSets.Specs/DataTableSpecs.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/FluentAssertions.DataSets.Specs/DataTableSpecs.cs b/Tests/FluentAssertions.DataSets.Specs/DataTableSpecs.cs index eed892a..6a0da6e 100644 --- a/Tests/FluentAssertions.DataSets.Specs/DataTableSpecs.cs +++ b/Tests/FluentAssertions.DataSets.Specs/DataTableSpecs.cs @@ -246,7 +246,7 @@ public void When_excluding_invalid_constraint_it_should_throw() // Act Action action = () => subject.Should().BeEquivalentTo(expectation, options => options - .ExcludingRelated((Constraint constraint) => new object())); + .ExcludingRelated((Constraint _) => new object())); // Assert action.Should().Throw().WithMessage( From 57d8279fb637947ee2fb760767fcf1e1f83ed045 Mon Sep 17 00:00:00 2001 From: Jonas Nyrup Date: Fri, 27 Dec 2024 12:33:20 +0100 Subject: [PATCH 4/4] Use TheoryData for increased type safety --- .../DataSpecs.cs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Tests/FluentAssertions.DataSets.Specs/DataSpecs.cs b/Tests/FluentAssertions.DataSets.Specs/DataSpecs.cs index 1f2f86e..1500c07 100644 --- a/Tests/FluentAssertions.DataSets.Specs/DataSpecs.cs +++ b/Tests/FluentAssertions.DataSets.Specs/DataSpecs.cs @@ -4,6 +4,7 @@ using System.Data; using System.Diagnostics.CodeAnalysis; using System.Linq; +using Xunit; namespace FluentAssertions.DataSets.Specs; @@ -588,17 +589,24 @@ public enum ChangeType Removed, } - public static IEnumerable AllChangeTypes => - Enum.GetValues(typeof(ChangeType)).Cast().Select(t => new object[] { t }); + public static TheoryData AllChangeTypes => + new(Enum.GetValues(typeof(ChangeType)).Cast()); - public static IEnumerable AllChangeTypesWithAcceptChangesValues + public static TheoryData AllChangeTypesWithAcceptChangesValues { get { - return - from changeType in Enum.GetValues(typeof(ChangeType)).Cast() - from acceptChanges in new[] { true, false } - select new object[] { changeType, acceptChanges }; + var result = new TheoryData(); + + foreach (var changeType in Enum.GetValues(typeof(ChangeType)).Cast()) + { + foreach (var acceptChanges in new[] { true, false }) + { + result.Add(changeType, acceptChanges); + } + } + + return result; } }