-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Description
When looking for code coverage, found some noncovered code and writing a unit test for it gave a surprising behavior.
If I did not understand the functionality, and the behavior is actually correct, please close this issue.
Description
AssertionScope.AddNonReportable still reports the value in the failure message.
According to the documentation:
Tracks a keyed object in the current scope that is excluded from the failure message in case an assertion fails.
Complete minimal example reproducing the issue
[Fact]
public void When_using_non_reportable_value_it_should_not_be_replaced_with_context()
{
// Arrange
var scope = new AssertionScope();
scope.AddNonReportable("SomeKey", "SomeValue");
AssertionScope.Current.FailWith("{SomeKey}");
// Act
Action act = scope.Dispose;
// Assert
act.Should().ThrowExactly<XunitException>()
.Which.Message.Should().NotContain("SomeValue");
}Expected behavior:
The message should not replace "{SomeKey}".
Actual behavior:
It is replaced.
Versions
- 6.0 beta 1
Metadata
Metadata
Assignees
Labels
No labels