fluentassertions / fluentassertions/fluentassertions
Some parent equivalency options are not included in failure message
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 720
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 29
Description
### Description
When the global default equivalency assertion options are modified, they are not included in the failure message.
### Complete minimal example reproducing the issue
```cs
public class MyClass
{
public int Value { get; set; }
}
```
#### Local options
```cs
var subject = new MyClass { Value = 1 };
var expected = new MyClass { Value = 1 };
subject.Should().BeEquivalentTo(expected, opt => opt.ComparingByValue());
```
#### Global options
```cs
AssertionOptions.AssertEquivalencyUsing(opt => opt.ComparingByValue());
var subject = new MyClass { Value = 1 };
var expected = new MyClass { Value = 1 };
subject.Should().BeEquivalentTo(expected);
```
### Expected behavior:
Both failure messages should include the line
```
- Compare FluentAssertions.Specs.MyClass by value
```
### Actual behavior:
Only the local variant includes the expected line in the failure message.
### Versions
* Which version of Fluent Assertions are you using; 6.1.0
* Which .NET runtime and version are you targeting? .NET5
Contributor guide
Assessment
This issue has not been assessed yet.