diff --git a/AGENTS.md b/AGENTS.md index 7776dd9..bba968e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,7 +29,6 @@ The goal is to keep package structure, CI, versioning, tests, documentation, and ## Coding rules - Preserve existing naming. -- Do not introduce expression-bodied method declarations. - Prefer explicit, readable code over short clever code. - Public APIs must include XML documentation written in English. - Avoid breaking public API changes unless explicitly requested. diff --git a/tests/PANiXiDA.Core.SpecificationPattern.UnitTests/SpecificationPatternTests.cs b/tests/PANiXiDA.Core.SpecificationPattern.UnitTests/SpecificationPatternTests.cs index 45ece21..b695e7e 100644 --- a/tests/PANiXiDA.Core.SpecificationPattern.UnitTests/SpecificationPatternTests.cs +++ b/tests/PANiXiDA.Core.SpecificationPattern.UnitTests/SpecificationPatternTests.cs @@ -134,7 +134,7 @@ public void QueryableWhere_FiltersBySpecificationExpression() Specification specification = SpecificationFactory.Create( item => item.Category == "target"); - TestItem[] result = query.Where(specification).ToArray(); + TestItem[] result = [.. query.Where(specification)]; result.Should().HaveCount(2); result.Select(item => item.Value).Should().Equal(1, 3); @@ -164,16 +164,16 @@ public void QueryableWhere_WhenArgumentsAreNull_ThrowsArgumentNullException() [Fact(DisplayName = "Enumerable Where filters by specification predicate")] public void EnumerableWhere_FiltersBySpecificationPredicate() { - IEnumerable source = new[] - { + IEnumerable source = + [ CreateItem(1, category: "target"), CreateItem(2, category: "other"), CreateItem(3, category: "target") - }; + ]; Specification specification = SpecificationFactory.Create( item => item.Category == "target"); - TestItem[] result = source.Where(specification).ToArray(); + TestItem[] result = [.. source.Where(specification)]; result.Should().HaveCount(2); result.Select(item => item.Value).Should().Equal(1, 3); @@ -182,7 +182,7 @@ public void EnumerableWhere_FiltersBySpecificationPredicate() [Fact(DisplayName = "Enumerable Where throws when arguments are null")] public void EnumerableWhere_WhenArgumentsAreNull_ThrowsArgumentNullException() { - IEnumerable source = Array.Empty(); + IEnumerable source = []; Specification specification = SpecificationFactory.All(); Action nullSourceAct = () => SpecificationQueryableExtensions.Where( @@ -208,22 +208,15 @@ private static TestItem CreateItem( return new TestItem(value, category, tags); } - private sealed class TestItem + private sealed class TestItem( + int value, + string category, + IReadOnlyCollection tags) { - public TestItem( - int value, - string category, - IReadOnlyCollection tags) - { - Value = value; - Category = category; - Tags = tags; - } - - public int Value { get; } + public int Value { get; } = value; - public string Category { get; } + public string Category { get; } = category; - public IReadOnlyCollection Tags { get; } + public IReadOnlyCollection Tags { get; } = tags; } }