Skip to content

Commit

Permalink
Rename EquivalencyAssertionOptions to EquivalencyOptions (#2414)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbreuss authored Nov 4, 2023
1 parent 65412a2 commit 57d8ea1
Show file tree
Hide file tree
Showing 32 changed files with 291 additions and 292 deletions.
8 changes: 4 additions & 4 deletions Src/FluentAssertions/AssertionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace FluentAssertions;
/// </summary>
public static class AssertionOptions
{
private static EquivalencyAssertionOptions defaults = new();
private static EquivalencyOptions defaults = new();

static AssertionOptions()
{
Expand All @@ -21,9 +21,9 @@ static AssertionOptions()
/// <summary>
/// Creates a clone of the default options and allows the caller to modify them.
/// </summary>
public static EquivalencyAssertionOptions<T> CloneDefaults<T>()
public static EquivalencyOptions<T> CloneDefaults<T>()
{
return new EquivalencyAssertionOptions<T>(defaults);
return new EquivalencyOptions<T>(defaults);
}

/// <summary>
Expand All @@ -38,7 +38,7 @@ public static EquivalencyAssertionOptions<T> CloneDefaults<T>()
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="defaultsConfigurer"/> is <see langword="null"/>.</exception>
public static void AssertEquivalencyUsing(
Func<EquivalencyAssertionOptions, EquivalencyAssertionOptions> defaultsConfigurer)
Func<EquivalencyOptions, EquivalencyOptions> defaultsConfigurer)
{
Guard.ThrowIfArgumentIsNull(defaultsConfigurer);

Expand Down
42 changes: 21 additions & 21 deletions Src/FluentAssertions/Collections/GenericCollectionAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ public AndConstraint<TAssertions> AllBeEquivalentTo<TExpectation>(TExpectation e
/// </remarks>
/// <param name="expectation">The expected element.</param>
/// <param name="config">
/// A reference to the <see cref="EquivalencyAssertionOptions{TExpectation}"/> configuration object that can be used
/// A reference to the <see cref="EquivalencyOptions{TExpectation}"/> configuration object that can be used
/// to influence the way the object graphs are compared. You can also provide an alternative instance of the
/// <see cref="EquivalencyAssertionOptions{TSubject}"/> class. The global defaults are determined by the
/// <see cref="EquivalencyOptions{TExpectation}"/> class. The global defaults are determined by the
/// <see cref="AssertionOptions"/> class.
/// </param>
/// <param name="because">
Expand All @@ -178,7 +178,7 @@ public AndConstraint<TAssertions> AllBeEquivalentTo<TExpectation>(TExpectation e
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="config"/> is <see langword="null"/>.</exception>
public AndConstraint<TAssertions> AllBeEquivalentTo<TExpectation>(TExpectation expectation,
Func<EquivalencyAssertionOptions<TExpectation>, EquivalencyAssertionOptions<TExpectation>> config,
Func<EquivalencyOptions<TExpectation>, EquivalencyOptions<TExpectation>> config,
string because = "",
params object[] becauseArgs)
{
Expand All @@ -192,7 +192,7 @@ public AndConstraint<TAssertions> AllBeEquivalentTo<TExpectation>(TExpectation e
// in case user needs to use them. Strict ordering improves algorithmic complexity
// from O(n^2) to O(n). For bigger tables it is necessary in order to achieve acceptable
// execution times.
Func<EquivalencyAssertionOptions<TExpectation>, EquivalencyAssertionOptions<TExpectation>> forceStrictOrderingConfig =
Func<EquivalencyOptions<TExpectation>, EquivalencyOptions<TExpectation>> forceStrictOrderingConfig =
x => config(x).WithStrictOrderingFor(s => string.IsNullOrEmpty(s.Path));

return BeEquivalentTo(repeatedExpectation, forceStrictOrderingConfig, because, becauseArgs);
Expand Down Expand Up @@ -338,9 +338,9 @@ public AndConstraint<TAssertions> BeEquivalentTo<TExpectation>(IEnumerable<TExpe
/// </remarks>
/// <param name="expectation">An <see cref="IEnumerable{T}"/> with the expected elements.</param>
/// <param name="config">
/// A reference to the <see cref="EquivalencyAssertionOptions{TSubject}"/> configuration object that can be used
/// A reference to the <see cref="EquivalencyOptions{TExpectation}"/> configuration object that can be used
/// to influence the way the object graphs are compared. You can also provide an alternative instance of the
/// <see cref="EquivalencyAssertionOptions{TSubject}"/> class. The global defaults are determined by the
/// <see cref="EquivalencyOptions{TExpectation}"/> class. The global defaults are determined by the
/// <see cref="AssertionOptions"/> class.
/// </param>
/// <param name="because">
Expand All @@ -352,12 +352,12 @@ public AndConstraint<TAssertions> BeEquivalentTo<TExpectation>(IEnumerable<TExpe
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="config"/> is <see langword="null"/>.</exception>
public AndConstraint<TAssertions> BeEquivalentTo<TExpectation>(IEnumerable<TExpectation> expectation,
Func<EquivalencyAssertionOptions<TExpectation>, EquivalencyAssertionOptions<TExpectation>> config, string because = "",
Func<EquivalencyOptions<TExpectation>, EquivalencyOptions<TExpectation>> config, string because = "",
params object[] becauseArgs)
{
Guard.ThrowIfArgumentIsNull(config);

EquivalencyAssertionOptions<IEnumerable<TExpectation>> options =
EquivalencyOptions<IEnumerable<TExpectation>> options =
config(AssertionOptions.CloneDefaults<TExpectation>()).AsCollection();

var context =
Expand Down Expand Up @@ -853,9 +853,9 @@ public AndWhichConstraint<TAssertions, T> ContainEquivalentOf<TExpectation>(TExp
/// </remarks>
/// <param name="expectation">The expected element.</param>
/// <param name="config">
/// A reference to the <see cref="EquivalencyAssertionOptions{TSubject}"/> configuration object that can be used
/// A reference to the <see cref="EquivalencyOptions{TExpectation}"/> configuration object that can be used
/// to influence the way the object graphs are compared. You can also provide an alternative instance of the
/// <see cref="EquivalencyAssertionOptions{TSubject}"/> class. The global defaults are determined by the
/// <see cref="EquivalencyOptions{TExpectation}"/> class. The global defaults are determined by the
/// <see cref="AssertionOptions"/> class.
/// </param>
/// <param name="because">
Expand All @@ -867,8 +867,8 @@ public AndWhichConstraint<TAssertions, T> ContainEquivalentOf<TExpectation>(TExp
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="config"/> is <see langword="null"/>.</exception>
public AndWhichConstraint<TAssertions, T> ContainEquivalentOf<TExpectation>(TExpectation expectation,
Func<EquivalencyAssertionOptions<TExpectation>,
EquivalencyAssertionOptions<TExpectation>> config, string because = "", params object[] becauseArgs)
Func<EquivalencyOptions<TExpectation>,
EquivalencyOptions<TExpectation>> config, string because = "", params object[] becauseArgs)
{
Guard.ThrowIfArgumentIsNull(config);

Expand All @@ -879,7 +879,7 @@ public AndWhichConstraint<TAssertions, T> ContainEquivalentOf<TExpectation>(TExp

if (success)
{
EquivalencyAssertionOptions<TExpectation> options = config(AssertionOptions.CloneDefaults<TExpectation>());
EquivalencyOptions<TExpectation> options = config(AssertionOptions.CloneDefaults<TExpectation>());

using var scope = new AssertionScope();
scope.AddReportable("configuration", () => options.ToString());
Expand Down Expand Up @@ -1816,9 +1816,9 @@ public AndConstraint<TAssertions> NotBeEquivalentTo<TExpectation>(IEnumerable<TE
/// </summary>
/// <param name="unexpected">An <see cref="IEnumerable{T}"/> with the unexpected elements.</param>
/// /// <param name="config">
/// A reference to the <see cref="EquivalencyAssertionOptions{TSubject}"/> configuration object that can be used
/// A reference to the <see cref="EquivalencyOptions{TExpectation}"/> configuration object that can be used
/// to influence the way the object graphs are compared. You can also provide an alternative instance of the
/// <see cref="EquivalencyAssertionOptions{TSubject}"/> class. The global defaults are determined by the
/// <see cref="EquivalencyOptions{TExpectation}"/> class. The global defaults are determined by the
/// <see cref="AssertionOptions"/> class.
/// </param>
/// <param name="because">
Expand All @@ -1829,7 +1829,7 @@ public AndConstraint<TAssertions> NotBeEquivalentTo<TExpectation>(IEnumerable<TE
/// Zero or more objects to format using the placeholders in <paramref name="because" />.
/// </param>
public AndConstraint<TAssertions> NotBeEquivalentTo<TExpectation>(IEnumerable<TExpectation> unexpected,
Func<EquivalencyAssertionOptions<TExpectation>, EquivalencyAssertionOptions<TExpectation>> config,
Func<EquivalencyOptions<TExpectation>, EquivalencyOptions<TExpectation>> config,
string because = "", params object[] becauseArgs)
{
Guard.ThrowIfArgumentIsNull(unexpected, nameof(unexpected), "Cannot verify inequivalence against a <null> collection.");
Expand Down Expand Up @@ -2336,9 +2336,9 @@ public AndConstraint<TAssertions> NotContainEquivalentOf<TExpectation>(TExpectat
/// </remarks>
/// <param name="unexpected">The unexpected element.</param>
/// <param name="config">
/// A reference to the <see cref="EquivalencyAssertionOptions{TSubject}"/> configuration object that can be used
/// A reference to the <see cref="EquivalencyOptions{TExpectation}"/> configuration object that can be used
/// to influence the way the object graphs are compared. You can also provide an alternative instance of the
/// <see cref="EquivalencyAssertionOptions{TSubject}"/> class. The global defaults are determined by the
/// <see cref="EquivalencyOptions{TExpectation}"/> class. The global defaults are determined by the
/// <see cref="AssertionOptions"/> class.
/// </param>
/// <param name="because">
Expand All @@ -2351,8 +2351,8 @@ public AndConstraint<TAssertions> NotContainEquivalentOf<TExpectation>(TExpectat
/// <exception cref="ArgumentNullException"><paramref name="config"/> is <see langword="null"/>.</exception>
[SuppressMessage("Design", "MA0051:Method is too long", Justification = "Needs refactoring")]
public AndConstraint<TAssertions> NotContainEquivalentOf<TExpectation>(TExpectation unexpected,
Func<EquivalencyAssertionOptions<TExpectation>,
EquivalencyAssertionOptions<TExpectation>> config, string because = "", params object[] becauseArgs)
Func<EquivalencyOptions<TExpectation>,
EquivalencyOptions<TExpectation>> config, string because = "", params object[] becauseArgs)
{
Guard.ThrowIfArgumentIsNull(config);

Expand All @@ -2364,7 +2364,7 @@ public AndConstraint<TAssertions> NotContainEquivalentOf<TExpectation>(TExpectat

if (success)
{
EquivalencyAssertionOptions<TExpectation> options = config(AssertionOptions.CloneDefaults<TExpectation>());
EquivalencyOptions<TExpectation> options = config(AssertionOptions.CloneDefaults<TExpectation>());

var foundIndices = new List<int>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ public AndConstraint<TAssertions> BeEquivalentTo<TExpectation>(TExpectation expe
/// </remarks>
/// <param name="expectation">The expected element.</param>
/// <param name="config">
/// A reference to the <see cref="EquivalencyAssertionOptions{TSubject}"/> configuration object that can be used
/// A reference to the <see cref="EquivalencyOptions{TExpectation}"/> configuration object that can be used
/// to influence the way the object graphs are compared. You can also provide an alternative instance of the
/// <see cref="EquivalencyAssertionOptions{TSubject}"/> class. The global defaults are determined by the
/// <see cref="EquivalencyOptions{TExpectation}"/> class. The global defaults are determined by the
/// <see cref="AssertionOptions"/> class.
/// </param>
/// <param name="because">
Expand All @@ -212,12 +212,12 @@ public AndConstraint<TAssertions> BeEquivalentTo<TExpectation>(TExpectation expe
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="config"/> is <see langword="null"/>.</exception>
public AndConstraint<TAssertions> BeEquivalentTo<TExpectation>(TExpectation expectation,
Func<EquivalencyAssertionOptions<TExpectation>, EquivalencyAssertionOptions<TExpectation>> config, string because = "",
Func<EquivalencyOptions<TExpectation>, EquivalencyOptions<TExpectation>> config, string because = "",
params object[] becauseArgs)
{
Guard.ThrowIfArgumentIsNull(config);

EquivalencyAssertionOptions<TExpectation> options = config(AssertionOptions.CloneDefaults<TExpectation>());
EquivalencyOptions<TExpectation> options = config(AssertionOptions.CloneDefaults<TExpectation>());

var context =
new EquivalencyValidationContext(Node.From<TExpectation>(() => AssertionScope.Current.CallerIdentity), options)
Expand Down
16 changes: 8 additions & 8 deletions Src/FluentAssertions/Collections/StringCollectionAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public AndConstraint<TAssertions> BeEquivalentTo(IEnumerable<string> expectation
/// </remarks>
/// <param name="expectation">An <see cref="IEnumerable{String}"/> with the expected elements.</param>
/// <param name="config">
/// A reference to the <see cref="EquivalencyAssertionOptions{String}"/> configuration object that can be used
/// A reference to the <see cref="EquivalencyOptions{TExpectation}"/> configuration object that can be used
/// to influence the way the object graphs are compared. You can also provide an alternative instance of the
/// <see cref="EquivalencyAssertionOptions{String}"/> class. The global defaults are determined by the
/// <see cref="EquivalencyOptions{TExpectation}"/> class. The global defaults are determined by the
/// <see cref="AssertionOptions"/> class.
/// </param>
/// <param name="because">
Expand All @@ -121,12 +121,12 @@ public AndConstraint<TAssertions> BeEquivalentTo(IEnumerable<string> expectation
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="config"/> is <see langword="null"/>.</exception>
public AndConstraint<TAssertions> BeEquivalentTo(IEnumerable<string> expectation,
Func<EquivalencyAssertionOptions<string>, EquivalencyAssertionOptions<string>> config, string because = "",
Func<EquivalencyOptions<string>, EquivalencyOptions<string>> config, string because = "",
params object[] becauseArgs)
{
Guard.ThrowIfArgumentIsNull(config);

EquivalencyAssertionOptions<IEnumerable<string>>
EquivalencyOptions<IEnumerable<string>>
options = config(AssertionOptions.CloneDefaults<string>()).AsCollection();

var context =
Expand Down Expand Up @@ -170,9 +170,9 @@ public AndConstraint<TAssertions> AllBe(string expectation,
/// </summary>
/// <param name="expectation">An expected <see cref="string"/>.</param>
/// <param name="config">
/// A reference to the <see cref="EquivalencyAssertionOptions{String}"/> configuration object that can be used
/// A reference to the <see cref="EquivalencyOptions{TExpectation}"/> configuration object that can be used
/// to influence the way the object graphs are compared. You can also provide an alternative instance of the
/// <see cref="EquivalencyAssertionOptions{String}"/> class. The global defaults are determined by the
/// <see cref="EquivalencyOptions{TExpectation}"/> class. The global defaults are determined by the
/// <see cref="AssertionOptions"/> class.
/// </param>
/// <param name="because">
Expand All @@ -184,7 +184,7 @@ public AndConstraint<TAssertions> AllBe(string expectation,
/// </param>
/// <exception cref="ArgumentNullException"><paramref name="config"/> is <see langword="null"/>.</exception>
public AndConstraint<TAssertions> AllBe(string expectation,
Func<EquivalencyAssertionOptions<string>, EquivalencyAssertionOptions<string>> config,
Func<EquivalencyOptions<string>, EquivalencyOptions<string>> config,
string because = "",
params object[] becauseArgs)
{
Expand All @@ -198,7 +198,7 @@ public AndConstraint<TAssertions> AllBe(string expectation,
// in case user needs to use them. Strict ordering improves algorithmic complexity
// from O(n^2) to O(n). For bigger tables it is necessary in order to achieve acceptable
// execution times.
Func<EquivalencyAssertionOptions<string>, EquivalencyAssertionOptions<string>> forceStringOrderingConfig =
Func<EquivalencyOptions<string>, EquivalencyOptions<string>> forceStringOrderingConfig =
x => config(x).WithStrictOrderingFor(s => string.IsNullOrEmpty(s.Path));

return BeEquivalentTo(repeatedExpectation, forceStringOrderingConfig, because, becauseArgs);
Expand Down
2 changes: 1 addition & 1 deletion Src/FluentAssertions/Equivalency/Comparands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public Type RuntimeType
/// <remarks>
/// If the expectation is a nullable type, it should return the type of the wrapped object.
/// </remarks>
public Type GetExpectedType(IEquivalencyAssertionOptions options)
public Type GetExpectedType(IEquivalencyOptions options)
{
Type type = options.UseRuntimeTyping ? RuntimeType : CompileTimeType;

Expand Down
Loading

0 comments on commit 57d8ea1

Please sign in to comment.