/
IEquivalencyAssertionOptions.cs
126 lines (104 loc) · 4.61 KB
/
IEquivalencyAssertionOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
using System;
using System.Collections.Generic;
using System.ComponentModel;
using FluentAssertions.Equivalency.Tracing;
namespace FluentAssertions.Equivalency
{
/// <summary>
/// Provides the run-time details of the <see cref="EquivalencyAssertionOptions{TSubject}" /> class.
/// </summary>
public interface IEquivalencyAssertionOptions
{
/// <summary>
/// Gets an ordered collection of selection rules that define what members (e.g. properties or fields) are included.
/// </summary>
IEnumerable<IMemberSelectionRule> SelectionRules { get; }
/// <summary>
/// Gets an ordered collection of matching rules that determine which subject members are matched with which
/// expectation properties.
/// </summary>
IEnumerable<IMemberMatchingRule> MatchingRules { get; }
/// <summary>
/// Gets a value indicating whether or not the assertion must perform a deep comparison.
/// </summary>
bool IsRecursive { get; }
/// <summary>
/// Gets a value indicating whether recursion is allowed to continue indefinitely.
/// </summary>
bool AllowInfiniteRecursion { get; }
/// <summary>
/// Gets value indicating how cyclic references should be handled. By default, it will throw an exception.
/// </summary>
CyclicReferenceHandling CyclicReferenceHandling { get; }
/// <summary>
/// Gets an ordered collection of rules that determine whether or not the order of collections is important. By default,
/// ordering is irrelevant.
/// </summary>
OrderingRuleCollection OrderingRules { get; }
/// <summary>
/// Contains the rules for what properties to run an auto-conversion.
/// </summary>
ConversionSelector ConversionSelector { get; }
/// <summary>
/// Gets value indicating how the enums should be compared.
/// </summary>
EnumEquivalencyHandling EnumEquivalencyHandling { get; }
/// <summary>
/// Gets an ordered collection of Equivalency steps how a subject is compared with the expectation.
/// </summary>
IEnumerable<IEquivalencyStep> UserEquivalencySteps { get; }
/// <summary>
/// Gets a value indicating whether the runtime type of the expectation should be used rather than the declared type.
/// </summary>
bool UseRuntimeTyping { get; }
/// <summary>
/// Gets a value indicating whether and which properties should be considered.
/// </summary>
MemberVisibility IncludedProperties { get; }
/// <summary>
/// Gets a value indicating whether and which fields should be considered.
/// </summary>
MemberVisibility IncludedFields { get; }
/// <summary>
/// Gets a value indicating whether members on the subject marked with [EditorBrowsable]
/// and an EditorBrowsableState of Never should be treated as though they don't exist.
/// </summary>
bool IgnoreNonBrowsableOnSubject { get; }
/// <summary>
/// Gets a value indicating whether members on the expectation marked with [EditorBrowsable]
/// and an EditorBrowsableState of Never should be excluded.
/// </summary>
bool ExcludeNonBrowsableOnExpectation { get; }
/// <summary>
/// Gets a value indicating whether records should be compared by value instead of their members
/// </summary>
bool CompareRecordsByValue { get; }
/// <summary>
/// Gets the currently configured tracer, or <c>null</c> if no tracing was configured.
/// </summary>
ITraceWriter TraceWriter { get; }
/// <summary>
/// Determines the right strategy for evaluating the equality of objects of this type.
/// </summary>
EqualityStrategy GetEqualityStrategy(Type type);
}
public enum EqualityStrategy
{
/// <summary>
/// The object overrides <see cref="object.Equals(object)"/>, so use that.
/// </summary>
Equals,
/// <summary>
/// The object does not seem to override <see cref="object.Equals(object)"/>, so compare by members
/// </summary>
Members,
/// <summary>
/// Compare using <see cref="object.Equals(object)"/>, whether or not the object overrides it.
/// </summary>
ForceEquals,
/// <summary>
/// Compare the members, regardless of an <see cref="object.Equals(object)"/> override exists or not.
/// </summary>
ForceMembers,
}
}