fluentassertions / fluentassertions.analyzers

Analyzers based on the FluentAssertions best practices docs
https://www.fluentassertions.com/tips
MIT License
136 stars 21 forks source link

False warning of FAA0001 when using 2D array #309

Closed scott-moxham closed 6 months ago

scott-moxham commented 6 months ago

Description

When testing the length of a 2D array is 0, the analyzer reports that I should use .HaveCount(0) but this isn't available for 2D arrays.

Complete minimal example reproducing the issue

// Arrange
var array = new string[0, 0];

// Assert
array.Length.Should().Be(0);

Expected behavior:

Shouldn't be any issues flagged

Actual behavior:

I get an FAA0001 issue flagged with the message "Use .Should().HaveCount()"

Versions

Additional Information

Meir017 commented 6 months ago

@scott-moxham thanks for reporting this! fix coming up

scott-moxham commented 6 months ago

Thanks @Meir017 for your super-fast response