The analysis rule FAA0001: Use .Should().HaveSameCount() is triggered for inputs that are actually combined values:
// Arrange
var expectedFirstHalf = new List<int> {0};
var expectedSecondHalf = new List<int> {1};
// Act
var actual = new List<int> {10, 11};
// Assert
actual.Should().HaveCount(expectedFirstHalf.Count() + expectedSecondHalf.Count());
Expected behavior:
Since the input (expectedFirstHalf.Count() + expectedSecondHalf.Count()) is actually a calculated value, the analysis rule should not be triggered.
Description
The analysis rule FAA0001: Use
.Should().HaveSameCount()
is triggered for inputs that are actually combined values:Expected behavior:
Since the input (
expectedFirstHalf.Count() + expectedSecondHalf.Count()
) is actually a calculated value, the analysis rule should not be triggered.Actual behavior:
The rule is triggered and the code fix crashes.
Versions