@@ -9,6 +9,82 @@ public static class CodeFix
99 private static readonly ImplementValueConverterFix Fix = new ( ) ;
1010 private static readonly ExpectedDiagnostic ExpectedDiagnostic = ExpectedDiagnostic . Create ( "CS0535" ) ;
1111
12+ [ Test ]
13+ public static void IValueConverterConvert ( )
14+ {
15+ var before = @"
16+ namespace N
17+ {
18+ using System.Windows.Data;
19+
20+ public class C : ↓IValueConverter
21+ {
22+ object IValueConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
23+ {
24+ throw new System.NotSupportedException($""{nameof(C)} can only be used in OneWay bindings"");
25+ }
26+ }
27+ }" ;
28+
29+ var after = @"
30+ namespace N
31+ {
32+ using System.Windows.Data;
33+
34+ public class C : IValueConverter
35+ {
36+ object IValueConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
37+ {
38+ throw new System.NotSupportedException($""{nameof(C)} can only be used in OneWay bindings"");
39+ }
40+
41+ public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
42+ {
43+ throw new System.NotImplementedException();
44+ }
45+ }
46+ }" ;
47+ RoslynAssert . CodeFix ( Fix , ExpectedDiagnostic , before , after ) ;
48+ }
49+
50+ [ Test ]
51+ public static void IValueConverterConvertFileScopedNamespace ( )
52+ {
53+ var before = @"
54+ namespace N;
55+
56+ using System.Windows.Data;
57+
58+ public class C : ↓IValueConverter
59+ {
60+ object IValueConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
61+ {
62+ throw new System.NotSupportedException($""{nameof(C)} can only be used in OneWay bindings"");
63+ }
64+ }
65+ " ;
66+
67+ var after = @"
68+ namespace N;
69+
70+ using System.Windows.Data;
71+
72+ public class C : IValueConverter
73+ {
74+ object IValueConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
75+ {
76+ throw new System.NotSupportedException($""{nameof(C)} can only be used in OneWay bindings"");
77+ }
78+
79+ public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
80+ {
81+ throw new System.NotImplementedException();
82+ }
83+ }
84+ " ;
85+ RoslynAssert . CodeFix ( Fix , ExpectedDiagnostic , before , after ) ;
86+ }
87+
1288 [ Test ]
1389 public static void IValueConverterConvertBack ( )
1490 {
0 commit comments