Skip to content

Commit

Permalink
Improve the structure of a trace log
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisdoomen committed Feb 6, 2022
1 parent 8222d4d commit df6533f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Src/FluentAssertions/Equivalency/EquivalencyValidator.cs
Expand Up @@ -62,13 +62,14 @@ private static void UpdateScopeWithReportableContext(AssertionScope scope, Compa

private void RunStepsUntilEquivalencyIsProven(Comparands comparands, IEquivalencyValidationContext context)
{
using var _ = context.Tracer.WriteBlock(node => $"{node.Description}");

foreach (IEquivalencyStep step in AssertionOptions.EquivalencyPlan)
{
var result = step.Handle(comparands, context, this);
context.Tracer.WriteLine(_ => $"Step {step.GetType().Name} returned {result}");

if (result == EquivalencyResult.AssertionCompleted)
{
context.Tracer.WriteLine(_ => $"Equivalency was proven by {step.GetType().Name}");
return;
}
}
Expand Down
Expand Up @@ -18,7 +18,7 @@ public EquivalencyResult Handle(Comparands comparands, IEquivalencyValidationCon
context.Tracer.WriteLine(member =>
{
string strategyName = (strategy == EqualityStrategy.Equals)
? "Equals must be used" : "object overrides Equals";
? $"{expectationType} overrides Equals" : "we are forced to use Equals";
return $"Treating {member.Description} as a value type because {strategyName}.";
});
Expand Down
1 change: 1 addition & 0 deletions docs/_pages/releases.md
Expand Up @@ -17,6 +17,7 @@ sidebar:
* Improved the documentation on `BeLowerCased` and `BeUpperCased` for strings with non-alphabetic characters - [#1792](https://github.com/fluentassertions/fluentassertions/pull/1792)
* Caller identification does not handle all arguments using `new` - [#1794](https://github.com/fluentassertions/fluentassertions/pull/1794)
* Resolve an issue preventing `HaveAccessModifier` from correctly recognizing internal interfaces and enums - [#1793](https://github.com/fluentassertions/fluentassertions/issues/1793)
* Improved tracing for nested `AssertionScope`s - [#1797](https://github.com/fluentassertions/fluentassertions/pull/1797)

### Fixes (Extensibility)
* Fixed a continuation issue when using `ClearExpectation` - [#1791](https://github.com/fluentassertions/fluentassertions/pull/1791)
Expand Down

0 comments on commit df6533f

Please sign in to comment.