fluentassertions.analyzers
fluentassertions.analyzers copied to clipboard
Analyzers based on the FluentAssertions best practices docs
### Description Analyzer incorrectly recommends `ContainsSingle()` for `HaveCount(1).And.Contains(predicate)` but looking at the tests for ContaiansSingle they are not equivalent as shown by this test https://github.com/fluentassertions/fluentassertions/blob/501cf353ecc872154fae54960ee1b692851bfb8a/Tests/FluentAssertions.Specs/Collections/GenericCollectionAssertionsSpecs.cs#L302-L314 which passes when a collection...
### Description The rules `CollectionShouldContainSingleAnalyzer` and `CollectionShouldBeEmptyAnalyzer` throws `InvalidOperationException` with message `This operation does not apply to an empty instance`. For some weird reason, the stack trace disappear every time...
failing test demonstrating fluentassertions/fluentassertions.analyzers#82
```csharp // cloudEvent.Time is Nullable (cloudEvent.Time?.ToUniversalTime()).Should().Be(cloudEvent2.Time?.ToUniversalTime()); ``` This code will get a NullConditionalAssertion warning. But ```csharp var x = cloudEvent.Time?.ToUniversalTime(); x.Should().Be(cloudEvent2.Time?.ToUniversalTime()); ``` has no warning. Is it a bug of...
### Description When a class implements `IDictionary` and a custom `ContainsKey(TKey1, TKey2)`, the analyzer does not distinguish between `IDictionary.ContainsKey(TKey)` and `ContainsKey(TKey1, TKey2)`. Related to #65 ### Complete minimal example reproducing...
### Description When installing the NuGet-package using paket, an IOException is thrown: ``` Paket failed with -> Error during extraction of D:\projects\...\packages\FluentAssertions.Analyzers\fluentassertions.analyzers.0.11.4.nupkg. In rare cases a firewall might have blocked...
### Description In some of my projects I get the following error when building: ``` CSC : warning AD0001: Analyzer 'FluentAssertions.Analyzers.CollectionShouldHaveCountAnalyzer' threw an exception of type 'System.InvalidOperationException' with message 'This...
https://github.com/fluentassertions/fluentassertions/blob/5.2.0/docs/_data/tips/datetimes.yml
https://github.com/fluentassertions/fluentassertions/blob/master/docs/_data/tips/types.yml
for example: ```cs public class MyCustomException : Exception { public string MyCustomProperty { get; } public MyCustomException(string myCustomProperty) { MyCustomProperty = MyCustomProperty; } } ``` when hovering over the property...