Skip to content

Commit 314fcb8

Browse files
committed
More tests
1 parent 18bffc1 commit 314fcb8

2 files changed

Lines changed: 79 additions & 2 deletions

File tree

WpfAnalyzers.Test/ImplementValueConverterFixTests/CodeFix.cs

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,45 @@ object IValueConverter.ConvertBack(object value, System.Type targetType, object
161161
RoslynAssert.CodeFix(Fix, ExpectedDiagnostic, before, after);
162162
}
163163

164+
[Test]
165+
public static void IMultiValueConverterConvert()
166+
{
167+
var before = @"
168+
namespace N
169+
{
170+
using System.Windows.Data;
171+
172+
public class C : ↓IMultiValueConverter
173+
{
174+
object[] IMultiValueConverter.ConvertBack(object value, System.Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
175+
{
176+
throw new System.NotSupportedException($""{nameof(C)} can only be used in OneWay bindings"");
177+
}
178+
}
179+
}";
180+
181+
var after = @"
182+
namespace N
183+
{
184+
using System.Windows.Data;
185+
186+
public class C : IMultiValueConverter
187+
{
188+
object[] IMultiValueConverter.ConvertBack(object value, System.Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
189+
{
190+
throw new System.NotSupportedException($""{nameof(C)} can only be used in OneWay bindings"");
191+
}
192+
193+
public object Convert(object[] values, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
194+
{
195+
throw new System.NotImplementedException();
196+
}
197+
}
198+
}";
199+
200+
RoslynAssert.CodeFix(Fix, ExpectedDiagnostic, before, after);
201+
}
202+
164203
[Test]
165204
public static void IMultiValueConverterConvertBack()
166205
{
@@ -199,4 +238,43 @@ object[] IMultiValueConverter.ConvertBack(object value, System.Type[] targetType
199238

200239
RoslynAssert.CodeFix(Fix, ExpectedDiagnostic, before, after);
201240
}
241+
242+
[Test]
243+
public static void IMultiValueConverterConvertBackFileScopedNamespace()
244+
{
245+
var before = @"
246+
namespace N;
247+
248+
using System.Windows.Data;
249+
250+
public class C : ↓IMultiValueConverter
251+
{
252+
public object Convert(object[] values, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
253+
{
254+
throw new System.NotImplementedException();
255+
}
256+
}
257+
";
258+
259+
var after = @"
260+
namespace N;
261+
262+
using System.Windows.Data;
263+
264+
public class C : IMultiValueConverter
265+
{
266+
public object Convert(object[] values, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
267+
{
268+
throw new System.NotImplementedException();
269+
}
270+
271+
object[] IMultiValueConverter.ConvertBack(object value, System.Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
272+
{
273+
throw new System.NotSupportedException($""{nameof(C)} can only be used in OneWay bindings"");
274+
}
275+
}
276+
";
277+
278+
RoslynAssert.CodeFix(Fix, ExpectedDiagnostic, before, after);
279+
}
202280
}

WpfAnalyzers.Test/ImplementValueConverterFixTests/FixAll.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ namespace WpfAnalyzers.Test.ImplementValueConverterFixTests;
44
using Gu.Roslyn.Asserts;
55
using NUnit.Framework;
66

7-
[Explicit("Seems like assert hangs")]
87
public static class FixAll
98
{
109
private static readonly ImplementValueConverterFix Fix = new();
@@ -109,7 +108,7 @@ object[] IMultiValueConverter.ConvertBack(object value, System.Type[] targetType
109108

110109
RoslynAssert.FixAll(Fix, ExpectedDiagnostic, before, after);
111110
}
112-
111+
113112
[Test]
114113
public static void FullyQualifiedIMultiValueConverter()
115114
{

0 commit comments

Comments
 (0)