You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Test]publicstaticvoidWhenCastAndUnsubscribed(){varbefore=@"namespace N{ using System; using System.ComponentModel; public class C { protected void M(object ↓source) { ((INotifyPropertyChanged)source).PropertyChanged -= this.M; } private void M(object sender, PropertyChangedEventArgs e) { } }}";varafter=@"namespace N{ using System; using System.ComponentModel; public class C { protected void M(object source) { if (source is null) { throw new ArgumentNullException(nameof(source)); } ((INotifyPropertyChanged)source).PropertyChanged -= this.M; } private void M(object sender, PropertyChangedEventArgs e) { } }}";RoslynAssert.CodeFix(Analyzer,Fix,ExpectedDiagnostic,before,after);}[Test]publicstaticvoidWhenCastAndInvoked(){varbefore=@"namespace N{ using System; using System.ComponentModel; public class C { protected void M(object ↓source) { ((string)source).ToString(); } }}";varafter=@"namespace N{ using System; using System.ComponentModel; public class C { protected void M(object source) { if (source is null) { throw new ArgumentNullException(nameof(source)); } ((string)source).ToString(); } }}";RoslynAssert.CodeFix(Analyzer,Fix,ExpectedDiagnostic,before,after);}
Before:
After:
The text was updated successfully, but these errors were encountered: