From 019389cc670f46641820a91460a2b7045259a7f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 14:30:18 +0200 Subject: [PATCH] Bump Roslynator.Analyzers from 4.12.0 to 4.12.3 (#2643) * Bump Roslynator.Analyzers from 4.12.0 to 4.12.3 Bumps [Roslynator.Analyzers](https://github.com/dotnet/roslynator) from 4.12.0 to 4.12.3. - [Release notes](https://github.com/dotnet/roslynator/releases) - [Changelog](https://github.com/dotnet/roslynator/blob/main/ChangeLog.md) - [Commits](https://github.com/dotnet/roslynator/compare/v4.12.0...v4.12.3) --- updated-dependencies: - dependency-name: Roslynator.Analyzers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Use element access over LINQ --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jonas Nyrup --- Directory.Build.props | 2 +- .../CollectionAssertionSpecs.BeInAscendingOrder.cs | 9 ++++----- .../CollectionAssertionSpecs.BeInDescendingOrder.cs | 9 ++++----- .../Collections/CollectionAssertionSpecs.cs | 2 +- .../FluentAssertions.Specs/Events/EventAssertionSpecs.cs | 2 +- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index f337cbcb5..bf889b0b7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -30,7 +30,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeInAscendingOrder.cs b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeInAscendingOrder.cs index 4c5d29671..4c01511d9 100644 --- a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeInAscendingOrder.cs +++ b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeInAscendingOrder.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Linq.Expressions; using FluentAssertions.Execution; using Xunit; @@ -351,7 +350,7 @@ public void When_strings_are_in_ascending_order_according_to_a_custom_lambda_it_ string[] strings = ["alpha", "beta", "theta"]; // Act - Action act = () => strings.Should().BeInAscendingOrder((sut, exp) => sut.Last().CompareTo(exp.Last())); + Action act = () => strings.Should().BeInAscendingOrder((sut, exp) => sut[^1].CompareTo(exp[^1])); // Assert act.Should().NotThrow(); @@ -365,7 +364,7 @@ public void When_strings_are_not_in_ascending_order_according_to_a_custom_lambda // Act Action act = () => - strings.Should().BeInAscendingOrder((sut, exp) => sut.Last().CompareTo(exp.Last()), "of {0}", "reasons"); + strings.Should().BeInAscendingOrder((sut, exp) => sut[^1].CompareTo(exp[^1]), "of {0}", "reasons"); // Assert act.Should() @@ -761,7 +760,7 @@ public void When_strings_are_not_in_ascending_order_according_to_a_custom_lambda string[] strings = ["roy", "dennis", "thomas"]; // Act - Action act = () => strings.Should().NotBeInAscendingOrder((sut, exp) => sut.Last().CompareTo(exp.Last())); + Action act = () => strings.Should().NotBeInAscendingOrder((sut, exp) => sut[^1].CompareTo(exp[^1])); // Assert act.Should().NotThrow(); @@ -775,7 +774,7 @@ public void When_strings_are_unexpectedly_in_ascending_order_according_to_a_cust // Act Action act = () => - strings.Should().NotBeInAscendingOrder((sut, exp) => sut.Last().CompareTo(exp.Last()), "of {0}", "reasons"); + strings.Should().NotBeInAscendingOrder((sut, exp) => sut[^1].CompareTo(exp[^1]), "of {0}", "reasons"); // Assert act.Should() diff --git a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeInDescendingOrder.cs b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeInDescendingOrder.cs index ac27e7529..fa025d9b2 100644 --- a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeInDescendingOrder.cs +++ b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeInDescendingOrder.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using Xunit; using Xunit.Sdk; @@ -263,7 +262,7 @@ public void When_strings_are_in_descending_order_based_on_a_custom_lambda_it_sho string[] strings = ["roy", "dennis", "barbara"]; // Act - Action act = () => strings.Should().BeInDescendingOrder((sut, exp) => sut.Last().CompareTo(exp.Last())); + Action act = () => strings.Should().BeInDescendingOrder((sut, exp) => sut[^1].CompareTo(exp[^1])); // Assert act.Should().NotThrow(); @@ -277,7 +276,7 @@ public void When_strings_are_not_in_descending_order_based_on_a_custom_lambda_it // Act Action act = () => - strings.Should().BeInDescendingOrder((sut, exp) => sut.Last().CompareTo(exp.Last()), "of {0}", "reasons"); + strings.Should().BeInDescendingOrder((sut, exp) => sut[^1].CompareTo(exp[^1]), "of {0}", "reasons"); // Assert act.Should() @@ -572,7 +571,7 @@ public void When_strings_are_not_in_descending_order_based_on_a_custom_lambda_it string[] strings = ["dennis", "roy", "barbara"]; // Act - Action act = () => strings.Should().NotBeInDescendingOrder((sut, exp) => sut.Last().CompareTo(exp.Last())); + Action act = () => strings.Should().NotBeInDescendingOrder((sut, exp) => sut[^1].CompareTo(exp[^1])); // Assert act.Should().NotThrow(); @@ -586,7 +585,7 @@ public void When_strings_are_unexpectedly_in_descending_order_based_on_a_custom_ // Act Action act = () => - strings.Should().NotBeInDescendingOrder((sut, exp) => sut.Last().CompareTo(exp.Last()), "of {0}", "reasons"); + strings.Should().NotBeInDescendingOrder((sut, exp) => sut[^1].CompareTo(exp[^1]), "of {0}", "reasons"); // Assert act.Should() diff --git a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.cs index 03e2740b5..e539aacad 100644 --- a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.cs @@ -218,7 +218,7 @@ private class ByLastCharacterComparer : IComparer { public int Compare(string x, string y) { - return x.Last().CompareTo(y.Last()); + return x[^1].CompareTo(y[^1]); } } } diff --git a/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs index 5705d70b0..20268bfb8 100644 --- a/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Events/EventAssertionSpecs.cs @@ -409,7 +409,7 @@ public void When_constraints_are_specified_it_should_filter_the_events_based_on_ recording .Should().ContainSingle("because we were expecting a specific property change") - .Which.Parameters.Last().Should().BeOfType() + .Which.Parameters[^1].Should().BeOfType() .Which.PropertyName.Should().Be("Boo"); }