public void IsCheckedWhenOldStyleNullCheckOrOtherCheck() { var testCode = @" namespace RoslynSandbox { using System; public class Foo { private readonly string text; public Foo(string text, string other) { if (text == null || other == null) { throw new ArgumentNullException(nameof(text)); } this.text = text; } } }"; var syntaxTree = CSharpSyntaxTree.ParseText(testCode); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }); var semanticModel = compilation.GetSemanticModel(syntaxTree); var parameter = syntaxTree.FindParameter("text"); var symbol = semanticModel.GetDeclaredSymbol(parameter); Assert.AreEqual(true, NullCheck.IsChecked(symbol, parameter.FirstAncestor <ConstructorDeclarationSyntax>(), semanticModel, CancellationToken.None)); }