Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_attribute_sections = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
Expand Down
2 changes: 1 addition & 1 deletion Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Build : NukeBuild
string PullRequestBase => GitHubActions?.BaseRef;

[Parameter("Use this parameter if you encounter build problems in any way, " +
"to generate a .binlog file which holds some useful information.")]
"to generate a .binlog file which holds some useful information.")]
readonly bool? GenerateBinLog;

[Parameter("The key to push to Nuget")]
Expand Down
6 changes: 3 additions & 3 deletions Src/FluentAssertions/Primitives/StringAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public AndConstraint<TAssertions> NotMatchEquivalentOf(string wildcardPattern, s
/// Zero or more objects to format using the placeholders in <paramref name="because" />.
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="regularExpression"/> is <see langword="null"/>.</exception>
public AndConstraint<TAssertions> MatchRegex([RegexPattern] [StringSyntax("Regex")] string regularExpression,
public AndConstraint<TAssertions> MatchRegex([RegexPattern][StringSyntax("Regex")] string regularExpression,
OccurrenceConstraint occurrenceConstraint, string because = "", params object[] becauseArgs)
{
Guard.ThrowIfArgumentIsNull(regularExpression, nameof(regularExpression),
Expand Down Expand Up @@ -443,7 +443,7 @@ public AndConstraint<TAssertions> MatchRegex([RegexPattern] [StringSyntax("Regex
/// Zero or more objects to format using the placeholders in <paramref name="because" />.
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="regularExpression"/> is <see langword="null"/>.</exception>
public AndConstraint<TAssertions> MatchRegex([RegexPattern] [StringSyntax("Regex")] string regularExpression,
public AndConstraint<TAssertions> MatchRegex([RegexPattern][StringSyntax("Regex")] string regularExpression,
string because = "", params object[] becauseArgs)
{
Guard.ThrowIfArgumentIsNull(regularExpression, nameof(regularExpression),
Expand Down Expand Up @@ -578,7 +578,7 @@ public AndConstraint<TAssertions> MatchRegex(Regex regularExpression,
/// Zero or more objects to format using the placeholders in <paramref name="because" />.
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="regularExpression"/> is <see langword="null"/>.</exception>
public AndConstraint<TAssertions> NotMatchRegex([RegexPattern] [StringSyntax("Regex")] string regularExpression,
public AndConstraint<TAssertions> NotMatchRegex([RegexPattern][StringSyntax("Regex")] string regularExpression,
string because = "", params object[] becauseArgs)
{
Guard.ThrowIfArgumentIsNull(regularExpression, nameof(regularExpression),
Expand Down
5 changes: 2 additions & 3 deletions Tests/Benchmarks/CheckIfMemberIsBrowsable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ public class CheckIfMemberIsBrowsableBenchmarks
.GetField(IsBrowsable ? nameof(BrowsableField) : nameof(NonBrowsableField));

[Benchmark]
public void CheckIfMemberIsBrowsable()
public bool CheckIfMemberIsBrowsable()
{
bool _ =
SubjectField.GetCustomAttribute<EditorBrowsableAttribute>() is not { State: EditorBrowsableState.Never };
return SubjectField.GetCustomAttribute<EditorBrowsableAttribute>() is not { State: EditorBrowsableState.Never };
}
}
34 changes: 9 additions & 25 deletions Tests/FluentAssertions.Equivalency.Specs/CollectionSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,6 @@ public void CopyTo(Array array, int index)
public bool IsSynchronized => ((ICollection)inner).IsSynchronized;
}

private class MultiEnumerable : IEnumerable<int>, IEnumerable<long>
{
private readonly List<int> ints = new();
private readonly List<long> longs = new();

IEnumerator<int> IEnumerable<int>.GetEnumerator()
{
return ints.GetEnumerator();
}

public IEnumerator GetEnumerator()
{
return GetEnumerator();
}

IEnumerator<long> IEnumerable<long>.GetEnumerator()
{
return longs.GetEnumerator();
}
}

private class EnumerableOfStringAndObject : IEnumerable<object>, IEnumerable<string>
{
IEnumerator IEnumerable.GetEnumerator()
Expand Down Expand Up @@ -1245,13 +1224,17 @@ public void When_all_subject_items_are_equivalent_to_expectation_object_it_shoul
};

// Act
Action action = () => subject.Should().AllBeEquivalentTo(new
Action action = () =>
{
var expectation = new
{
Name = "someDto",
Age = 1,
Birthdate = default(DateTime)
})
.And.HaveCount(3);
};

subject.Should().AllBeEquivalentTo(expectation).And.HaveCount(3);
};

// Assert
action.Should().NotThrow();
Expand Down Expand Up @@ -2649,7 +2632,8 @@ public static IEnumerable<object[]> ArrayTestData()
new int?[] { null, 1 }, new int?[] { 1, null }, new object[] { null, 1 }, new object[] { 1, null }
};

return from x in arrays
return
from x in arrays
from y in arrays
select new[] { x, y };
}
Expand Down
3 changes: 1 addition & 2 deletions Tests/FluentAssertions.Equivalency.Specs/EnumSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ public void When_asserting_members_from_different_enum_types_are_equivalent_by_s
// Arrange
var subject = new ClassWithEnumOne { Enum = EnumOne.Two };

var expectation = new ClassWithEnumThree
{ Enum = EnumThree.Two };
var expectation = new ClassWithEnumThree { Enum = EnumThree.Two };

// Act
Action act = () => subject.Should().BeEquivalentTo(expectation, config => config.ComparingEnumsByName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2759,7 +2759,8 @@ public static object[] Dictionaries()

public static IEnumerable<object[]> DictionariesData()
{
return from x in Dictionaries()
return
from x in Dictionaries()
from y in Dictionaries()
select new[] { x, y };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public void When_comparing_a_non_numeric_to_a_numeric_it_should_fail(object actu

public static IEnumerable<object[]> GetNonNumericAndNumericData()
{
return from x in GetNonNumericIConvertibles()
return
from x in GetNonNumericIConvertibles()
from y in GetNumericIConvertibles()
select new[] { x, y };
}
Expand All @@ -101,7 +102,8 @@ public void When_comparing_a_numeric_to_a_non_numeric_it_should_fail(object actu

public static IEnumerable<object[]> GetNumericAndNonNumericData()
{
return from x in GetNumericIConvertibles()
return
from x in GetNumericIConvertibles()
from y in GetNonNumericIConvertibles()
select new[] { x, y };
}
Expand Down