We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a custom dictionary that has a method with the signature: public bool ContainsKey(TKey1 key1, TKey2 key2).
public bool ContainsKey(TKey1 key1, TKey2 key2)
This incorrectly triggers DictionaryShouldContainsKey.
DictionaryShouldContainsKey
class MyDict<TKey, TValue> { public bool ContainsKey(TKey key) => false; }
var dict = new MyDict<int, string>(); dict.ContainsKey(0).Should().BeTrue();
is transformed into
dict.Should().ContainKey(0);
As dict is not a Dictionary, Should() returns an ObjectAssertions which does not have the ContainKey() assertion.
dict
Dictionary
Should()
ObjectAssertions
ContainKey()
class MyDict2<TKey1, TKey2, TValue> : Dictionary<TKey1, TValue> { public bool ContainsKey(TKey1 key1, TKey2 key2) => false; }
var dict2 = new MyDict2<int, int, string>(); dict2.ContainsKey(0, 0).Should().BeTrue();
is
var dict2 = new MyDict2<int, int, string>(); dict2.Should().ContainKey(0, 0);
but there is no such ContainKey(0, 0) on GenericDictionaryAssertions
ContainKey(0, 0)
GenericDictionaryAssertions
The analyzer should not be triggered.
The analyzer was triggered
Fluent Assertions Analyzers 0.11.2 .NET framework 4.6.1
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Description
I have a custom dictionary that has a method with the signature:
public bool ContainsKey(TKey1 key1, TKey2 key2)
.This incorrectly triggers
DictionaryShouldContainsKey
.Complete minimal example reproducing the issue
is transformed into
As
dict
is not aDictionary
,Should()
returns anObjectAssertions
which does not have theContainKey()
assertion.is
but there is no such
ContainKey(0, 0)
onGenericDictionaryAssertions
Expected behavior:
The analyzer should not be triggered.
Actual behavior:
The analyzer was triggered
Versions
Fluent Assertions Analyzers 0.11.2
.NET framework 4.6.1
The text was updated successfully, but these errors were encountered: