Skip to content

Commit

Permalink
Use spread operator
Browse files Browse the repository at this point in the history
  • Loading branch information
jnyrup committed Jan 1, 2024
1 parent 9222e0f commit e1f7606
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Src/FluentAssertions/Common/TypeMemberReflector.cs
Expand Up @@ -18,7 +18,7 @@ public TypeMemberReflector(Type typeToReflect, MemberVisibility visibility)
{
Properties = LoadProperties(typeToReflect, visibility);
Fields = LoadFields(typeToReflect, visibility);
Members = Properties.Concat<MemberInfo>(Fields).ToArray();
Members = [.. Properties, .. Fields];
}

public MemberInfo[] Members { get; }
Expand Down
30 changes: 15 additions & 15 deletions Tests/FluentAssertions.Specs/AssertionExtensionsSpecs.cs
Expand Up @@ -129,21 +129,21 @@ public void Should_methods_have_a_matching_overload_to_guard_against_chaining_an
.Where(m => m.Name == "Should")
.ToList();

List<Type> realOverloads = shouldOverloads
.Where(m => !IsGuardOverload(m))
.Select(t => GetMostParentType(t.ReturnType))
.Distinct()
.Concat(new[]
{
// @jnyrup: DateTimeRangeAssertions and DateTimeOffsetRangeAssertions are manually added here,
// because they expose AndConstraints,
// and hence should have a guarding Should(DateTimeRangeAssertions _) overloads,
// but they do not have a regular Should() overload,
// as they are always constructed through the fluent API.
typeof(DateTimeRangeAssertions<>),
typeof(DateTimeOffsetRangeAssertions<>),
})
.ToList();
List<Type> realOverloads =
[
..shouldOverloads
.Where(m => !IsGuardOverload(m))
.Select(t => GetMostParentType(t.ReturnType))
.Distinct(),

// @jnyrup: DateTimeRangeAssertions and DateTimeOffsetRangeAssertions are manually added here,
// because they expose AndConstraints,
// and hence should have a guarding Should(DateTimeRangeAssertions _) overloads,
// but they do not have a regular Should() overload,
// as they are always constructed through the fluent API.
typeof(DateTimeRangeAssertions<>),
typeof(DateTimeOffsetRangeAssertions<>)
];

List<Type> fakeOverloads = shouldOverloads
.Where(m => IsGuardOverload(m))
Expand Down

0 comments on commit e1f7606

Please sign in to comment.