diff --git a/MoreLinq.Test/.editorconfig b/MoreLinq.Test/.editorconfig index e6073bfb4..70de25d38 100644 --- a/MoreLinq.Test/.editorconfig +++ b/MoreLinq.Test/.editorconfig @@ -40,9 +40,3 @@ dotnet_diagnostic.CA1861.severity = none # IDE0022: Use expression/block body for methods dotnet_diagnostic.IDE0022.severity = none - -# NUnit1030: The type of parameter provided by the TestCaseSource does not match the type of the parameter in the Test method -dotnet_diagnostic.NUnit1030.severity = suggestion - -# Nunit1029: The number of parameters provided by the TestCaseSource does not match the number of parameters in the Test method -dotnet_diagnostic.NUnit1029.severity = suggestion diff --git a/MoreLinq.Test/AggregateTest.cs b/MoreLinq.Test/AggregateTest.cs index bd2bafe7c..a1bbec1b8 100644 --- a/MoreLinq.Test/AggregateTest.cs +++ b/MoreLinq.Test/AggregateTest.cs @@ -25,14 +25,13 @@ namespace MoreLinq.Test using Experimental; using System.Reactive.Linq; using System.Reflection; - using NUnit.Framework.Interfaces; using static MoreLinq.Extensions.AppendExtension; using static FuncModule; [TestFixture] public class AggregateTest { - public static IEnumerable AccumulatorsTestSource(string name, int count) => + public static IEnumerable AccumulatorsTestSource(string name, int count) => /* Generates an invocation as follows for 2 accumulators: diff --git a/MoreLinq.Test/NullArgumentTest.cs b/MoreLinq.Test/NullArgumentTest.cs index 22b3c2a99..f8e7ddad4 100644 --- a/MoreLinq.Test/NullArgumentTest.cs +++ b/MoreLinq.Test/NullArgumentTest.cs @@ -24,7 +24,6 @@ namespace MoreLinq.Test using System.Reflection; using System.Threading.Tasks; using NUnit.Framework; - using NUnit.Framework.Interfaces; using StackTrace = System.Diagnostics.StackTrace; [TestFixture] @@ -38,7 +37,7 @@ public void NotNull(Action testCase) => public void CanBeNull(Action testCase) => testCase(); - static IEnumerable GetNotNullTestCases() => + static IEnumerable GetNotNullTestCases() => GetTestCases(canBeNull: false, testCaseFactory: (method, args, paramName) => () => { Exception? e = null; @@ -61,15 +60,15 @@ static IEnumerable GetNotNullTestCases() => Assert.That(actualType, Is.SameAs(typeof(MoreEnumerable))); }); - static IEnumerable GetCanBeNullTestCases() => + static IEnumerable GetCanBeNullTestCases() => GetTestCases(canBeNull: true, testCaseFactory: (method, args, _) => () => method.Invoke(null, args)); - static IEnumerable GetTestCases(bool canBeNull, Func testCaseFactory) => + static IEnumerable GetTestCases(bool canBeNull, Func testCaseFactory) => from m in typeof(MoreEnumerable).GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly) from t in CreateTestCases(m, canBeNull, testCaseFactory) select t; - static IEnumerable CreateTestCases(MethodInfo methodDefinition, bool canBeNull, Func testCaseFactory) + static IEnumerable CreateTestCases(MethodInfo methodDefinition, bool canBeNull, Func testCaseFactory) { var method = InstantiateMethod(methodDefinition); var parameters = method.GetParameters().ToList(); @@ -82,7 +81,7 @@ where IsReferenceType(param) && CanBeNull(param) == canBeNull param.Name ?? throw new NullReferenceException()) #pragma warning restore CA2201 // Do not raise reserved exception types let testName = GetTestName(methodDefinition, param) - select (ITestCaseData)new TestCaseData(testCase).SetName(testName); + select new TestCaseData(testCase).SetName(testName); } static string GetTestName(MethodInfo definition, ParameterInfo parameter) => diff --git a/MoreLinq.Test/OrderedMergeTest.cs b/MoreLinq.Test/OrderedMergeTest.cs index 6efcc9574..f456f5216 100644 --- a/MoreLinq.Test/OrderedMergeTest.cs +++ b/MoreLinq.Test/OrderedMergeTest.cs @@ -19,12 +19,11 @@ namespace MoreLinq.Test { using System.Collections.Generic; using NUnit.Framework; - using NUnit.Framework.Interfaces; [TestFixture] public class OrderedMergeTest { - public static readonly IEnumerable TestData = + public static readonly IEnumerable TestData = from e in new[] { new diff --git a/MoreLinq.Test/PadStartTest.cs b/MoreLinq.Test/PadStartTest.cs index 5e84f6e3d..865299cc2 100644 --- a/MoreLinq.Test/PadStartTest.cs +++ b/MoreLinq.Test/PadStartTest.cs @@ -20,12 +20,11 @@ namespace MoreLinq.Test using System; using System.Collections.Generic; using NUnit.Framework; - using NUnit.Framework.Interfaces; [TestFixture] public class PadStartTest { - static readonly IEnumerable PadStartWithNegativeWidthCases = + static readonly IEnumerable PadStartWithNegativeWidthCases = from e in new (string Name, TestDelegate Delegate)[] { ("DefaultPadding" , static () => new object[0].PadStart(-1)), diff --git a/MoreLinq.Test/PadTest.cs b/MoreLinq.Test/PadTest.cs index 9a1f61949..f399a17c5 100644 --- a/MoreLinq.Test/PadTest.cs +++ b/MoreLinq.Test/PadTest.cs @@ -20,12 +20,11 @@ namespace MoreLinq.Test using System; using System.Collections.Generic; using NUnit.Framework; - using NUnit.Framework.Interfaces; [TestFixture] public class PadTest { - static readonly IEnumerable PadNegativeWidthCases = + static readonly IEnumerable PadNegativeWidthCases = from e in new (string Name, TestDelegate Delegate)[] { ("DefaultPadding" , static () => new object[0].Pad(-1)), diff --git a/MoreLinq.Test/PrependTest.cs b/MoreLinq.Test/PrependTest.cs index 00d5bf982..2855406d9 100644 --- a/MoreLinq.Test/PrependTest.cs +++ b/MoreLinq.Test/PrependTest.cs @@ -19,7 +19,6 @@ namespace MoreLinq.Test { using System.Collections.Generic; using NUnit.Framework; - using NUnit.Framework.Interfaces; using static MoreLinq.Extensions.PrependExtension; [TestFixture] @@ -64,7 +63,7 @@ public int[] PrependMany(int[] head, int[] tail) return tail.Aggregate(head.AsEnumerable(), MoreEnumerable.Prepend).ToArray(); } - public static IEnumerable PrependManySource => + public static IEnumerable PrependManySource => from x in Enumerable.Range(0, 11) from y in Enumerable.Range(1, 11) select new diff --git a/MoreLinq.Test/ReturnTest.cs b/MoreLinq.Test/ReturnTest.cs index cf8494047..7b6b45255 100644 --- a/MoreLinq.Test/ReturnTest.cs +++ b/MoreLinq.Test/ReturnTest.cs @@ -20,7 +20,6 @@ namespace MoreLinq.Test using System; using System.Collections.Generic; using NUnit.Framework; - using NUnit.Framework.Interfaces; public class ReturnTest { @@ -136,7 +135,7 @@ public void TestIndexOfAnItemNotContainedIsNegativeOne() Assert.That(SomeSingleton.List.IndexOf(new object()), Is.EqualTo(-1)); } - static IEnumerable UnsupportedActions(string testName) => + static IEnumerable UnsupportedActions(string testName) => from ma in new (string MethodName, Action Action)[] { ("Add" , () => SomeSingleton.List.Add(new object())), diff --git a/MoreLinq.Test/SkipUntilTest.cs b/MoreLinq.Test/SkipUntilTest.cs index ed327b72b..ff4424a13 100644 --- a/MoreLinq.Test/SkipUntilTest.cs +++ b/MoreLinq.Test/SkipUntilTest.cs @@ -18,7 +18,6 @@ namespace MoreLinq.Test { using NUnit.Framework; - using NUnit.Framework.Interfaces; using System.Collections.Generic; [TestFixture] @@ -60,7 +59,7 @@ public void SkipUntilEvaluatesPredicateLazily() sequence.AssertSequenceEqual(0, 1, 2); } - public static readonly IEnumerable TestData = + public static readonly IEnumerable TestData = from e in new[] { new { Source = new int[0] , Min = 0, Expected = new int[0] }, // empty sequence diff --git a/MoreLinq.Test/TrySingleTest.cs b/MoreLinq.Test/TrySingleTest.cs index e96a21fce..449131efb 100644 --- a/MoreLinq.Test/TrySingleTest.cs +++ b/MoreLinq.Test/TrySingleTest.cs @@ -21,7 +21,6 @@ namespace MoreLinq.Test using System.Collections; using System.Collections.Generic; using NUnit.Framework; - using NUnit.Framework.Interfaces; using Experimental; [TestFixture] @@ -64,10 +63,10 @@ public void TrySingleWithSingletonCollection(IEnumerable source, T result) Assert.That(value, Is.EqualTo(result)); } - static readonly ITestCaseData[] SingletonCollectionTestCases = + static readonly TestCaseData[] SingletonCollectionTestCases = [ - new TestCaseData(new BreakingSingleElementCollection(10), 10), - new TestCaseData(new BreakingSingleElementReadOnlyCollection(20), 20) + new(new BreakingSingleElementCollection(10), 10), + new(new BreakingSingleElementReadOnlyCollection(20), 20) ]; class BreakingSingleElementCollectionBase : IEnumerable diff --git a/MoreLinq.Test/ZipLongestTest.cs b/MoreLinq.Test/ZipLongestTest.cs index 6ead0148e..2034c9307 100644 --- a/MoreLinq.Test/ZipLongestTest.cs +++ b/MoreLinq.Test/ZipLongestTest.cs @@ -20,13 +20,12 @@ namespace MoreLinq.Test using System; using System.Collections.Generic; using NUnit.Framework; - using NUnit.Framework.Interfaces; using Tuple = System.ValueTuple; [TestFixture] public class ZipLongestTest { - public static readonly IEnumerable TestData = + public static readonly IEnumerable TestData = from e in new[] { new { A = Seq( ), B = Seq("foo", "bar", "baz"), Result = Seq<(int, string?)>((0, "foo"), (0, "bar"), (0, "baz")) },