diff --git a/src/Microsoft.Unity.Analyzers.Tests/UnityObjectNullHandlingTests.cs b/src/Microsoft.Unity.Analyzers.Tests/UnityObjectNullHandlingTests.cs index 14b34d1b..cf5c651e 100644 --- a/src/Microsoft.Unity.Analyzers.Tests/UnityObjectNullHandlingTests.cs +++ b/src/Microsoft.Unity.Analyzers.Tests/UnityObjectNullHandlingTests.cs @@ -250,10 +250,14 @@ public Transform NP() } "; + var context = AnalyzerVerificationContext + .Default // see https://github.com/Unity-Technologies/UnityCsReference/blob/master/Runtime/Export/Scripting/UnityEngineObject.bindings.cs + .WithAnalyzerFilter("CS0618"); // ignore Unity 2023.x warning CS0618 for now: 'Object.FindObjectOfType()' is obsolete' + var diagnostic = ExpectDiagnostic(UnityObjectNullHandlingAnalyzer.NullPropagationRule) .WithLocation(8, 9); - await VerifyCSharpDiagnosticAsync(test, diagnostic); + await VerifyCSharpDiagnosticAsync(context, test, diagnostic); // we cannot fix with side-effects await VerifyCSharpFixAsync(test, test);