From 634b901e7d7853bb9f66a0cca7e9497430ccd157 Mon Sep 17 00:00:00 2001 From: Sebastien Lebreton Date: Mon, 13 Mar 2023 19:37:48 +0100 Subject: [PATCH] ignore CS0618 for tests (#276) --- .../UnityObjectNullHandlingTests.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);