@@ -22,7 +22,11 @@ namespace CommunityToolkit.Mvvm.SourceGenerators.UnitTests;
2222public class Test_UseObservablePropertyOnSemiAutoPropertyCodeFixer
2323{
2424 [ TestMethod ]
25- public async Task SimpleProperty ( )
25+ #if ROSLYN_5_0_0_OR_GREATER
26+ [ DataRow ( LanguageVersion . CSharp14 ) ]
27+ #endif
28+ [ DataRow ( LanguageVersion . Preview ) ]
29+ public async Task SimpleProperty ( LanguageVersion languageVersion )
2630 {
2731 string original = """
2832 using CommunityToolkit.Mvvm.ComponentModel;
@@ -51,7 +55,7 @@ public partial class SampleViewModel : ObservableObject
5155 }
5256 """ ;
5357
54- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
58+ CSharpCodeFixTest test = new ( languageVersion )
5559 {
5660 TestCode = original ,
5761 FixedCode = @fixed ,
@@ -75,7 +79,11 @@ public partial class SampleViewModel : ObservableObject
7579 }
7680
7781 [ TestMethod ]
78- public async Task SimplePropertyWithBlockAccessorSyntax ( )
82+ #if ROSLYN_5_0_0_OR_GREATER
83+ [ DataRow ( LanguageVersion . CSharp14 ) ]
84+ #endif
85+ [ DataRow ( LanguageVersion . Preview ) ]
86+ public async Task SimplePropertyWithBlockAccessorSyntax ( LanguageVersion languageVersion )
7987 {
8088 string original = """
8189 using CommunityToolkit.Mvvm.ComponentModel;
@@ -110,7 +118,7 @@ public partial class SampleViewModel : ObservableObject
110118 }
111119 """ ;
112120
113- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
121+ CSharpCodeFixTest test = new ( languageVersion )
114122 {
115123 TestCode = original ,
116124 FixedCode = @fixed ,
@@ -134,7 +142,11 @@ public partial class SampleViewModel : ObservableObject
134142 }
135143
136144 [ TestMethod ]
137- public async Task SimplePropertyWithNestedBlockSyntax ( )
145+ #if ROSLYN_5_0_0_OR_GREATER
146+ [ DataRow ( LanguageVersion . CSharp14 ) ]
147+ #endif
148+ [ DataRow ( LanguageVersion . Preview ) ]
149+ public async Task SimplePropertyWithNestedBlockSyntax ( LanguageVersion languageVersion )
138150 {
139151 string original = """
140152 using CommunityToolkit.Mvvm.ComponentModel;
@@ -168,7 +180,7 @@ public partial class SampleViewModel : ObservableObject
168180 }
169181 """ ;
170182
171- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
183+ CSharpCodeFixTest test = new ( languageVersion )
172184 {
173185 TestCode = original ,
174186 FixedCode = @fixed ,
@@ -192,7 +204,11 @@ public partial class SampleViewModel : ObservableObject
192204 }
193205
194206 [ TestMethod ]
195- public async Task SimpleProperty_WithSemicolonTokenGetAccessor ( )
207+ #if ROSLYN_5_0_0_OR_GREATER
208+ [ DataRow ( LanguageVersion . CSharp14 ) ]
209+ #endif
210+ [ DataRow ( LanguageVersion . Preview ) ]
211+ public async Task SimpleProperty_WithSemicolonTokenGetAccessor ( LanguageVersion languageVersion )
196212 {
197213 string original = """
198214 using CommunityToolkit.Mvvm.ComponentModel;
@@ -221,7 +237,7 @@ public partial class SampleViewModel : ObservableObject
221237 }
222238 """ ;
223239
224- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
240+ CSharpCodeFixTest test = new ( languageVersion )
225241 {
226242 TestCode = original ,
227243 FixedCode = @fixed ,
@@ -245,7 +261,11 @@ public partial class SampleViewModel : ObservableObject
245261 }
246262
247263 [ TestMethod ]
248- public async Task SimpleProperty_WithMissingUsingDirective ( )
264+ #if ROSLYN_5_0_0_OR_GREATER
265+ [ DataRow ( LanguageVersion . CSharp14 ) ]
266+ #endif
267+ [ DataRow ( LanguageVersion . Preview ) ]
268+ public async Task SimpleProperty_WithMissingUsingDirective ( LanguageVersion languageVersion )
249269 {
250270 string original = """
251271 namespace MyApp;
@@ -272,7 +292,7 @@ public partial class SampleViewModel : CommunityToolkit.Mvvm.ComponentModel.Obse
272292 }
273293 """ ;
274294
275- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
295+ CSharpCodeFixTest test = new ( languageVersion )
276296 {
277297 TestCode = original ,
278298 FixedCode = @fixed ,
@@ -296,7 +316,11 @@ public partial class SampleViewModel : CommunityToolkit.Mvvm.ComponentModel.Obse
296316 }
297317
298318 [ TestMethod ]
299- public async Task SimpleProperty_WithLeadingTrivia ( )
319+ #if ROSLYN_5_0_0_OR_GREATER
320+ [ DataRow ( LanguageVersion . CSharp14 ) ]
321+ #endif
322+ [ DataRow ( LanguageVersion . Preview ) ]
323+ public async Task SimpleProperty_WithLeadingTrivia ( LanguageVersion languageVersion )
300324 {
301325 string original = """
302326 using CommunityToolkit.Mvvm.ComponentModel;
@@ -331,7 +355,7 @@ public partial class SampleViewModel : ObservableObject
331355 }
332356 """ ;
333357
334- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
358+ CSharpCodeFixTest test = new ( languageVersion )
335359 {
336360 TestCode = original ,
337361 FixedCode = @fixed ,
@@ -355,7 +379,11 @@ public partial class SampleViewModel : ObservableObject
355379 }
356380
357381 [ TestMethod ]
358- public async Task SimpleProperty_WithLeadingTrivia_AndAttributes ( )
382+ #if ROSLYN_5_0_0_OR_GREATER
383+ [ DataRow ( LanguageVersion . CSharp14 ) ]
384+ #endif
385+ [ DataRow ( LanguageVersion . Preview ) ]
386+ public async Task SimpleProperty_WithLeadingTrivia_AndAttributes ( LanguageVersion languageVersion )
359387 {
360388 string original = """
361389 using System;
@@ -400,7 +428,7 @@ public partial class SampleViewModel : ObservableObject
400428 public class TestAttribute(string text) : Attribute;
401429 """ ;
402430
403- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
431+ CSharpCodeFixTest test = new ( languageVersion )
404432 {
405433 TestCode = original ,
406434 FixedCode = @fixed ,
@@ -424,7 +452,11 @@ public class TestAttribute(string text) : Attribute;
424452 }
425453
426454 [ TestMethod ]
427- public async Task SimpleProperty_Multiple ( )
455+ #if ROSLYN_5_0_0_OR_GREATER
456+ [ DataRow ( LanguageVersion . CSharp14 ) ]
457+ #endif
458+ [ DataRow ( LanguageVersion . Preview ) ]
459+ public async Task SimpleProperty_Multiple ( LanguageVersion languageVersion )
428460 {
429461 string original = """
430462 using CommunityToolkit.Mvvm.ComponentModel;
@@ -462,7 +494,7 @@ public partial class SampleViewModel : ObservableObject
462494 }
463495 """ ;
464496
465- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
497+ CSharpCodeFixTest test = new ( languageVersion )
466498 {
467499 TestCode = original ,
468500 FixedCode = @fixed ,
@@ -492,7 +524,11 @@ public partial class SampleViewModel : ObservableObject
492524 }
493525
494526 [ TestMethod ]
495- public async Task SimpleProperty_Multiple_OnlyTriggersOnFirstOne ( )
527+ #if ROSLYN_5_0_0_OR_GREATER
528+ [ DataRow ( LanguageVersion . CSharp14 ) ]
529+ #endif
530+ [ DataRow ( LanguageVersion . Preview ) ]
531+ public async Task SimpleProperty_Multiple_OnlyTriggersOnFirstOne ( LanguageVersion languageVersion )
496532 {
497533 string original = """
498534 using CommunityToolkit.Mvvm.ComponentModel;
@@ -537,7 +573,7 @@ public string LastName
537573 }
538574 """ ;
539575
540- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
576+ CSharpCodeFixTest test = new ( languageVersion )
541577 {
542578 TestCode = original ,
543579 FixedCode = @fixed ,
@@ -561,7 +597,11 @@ public string LastName
561597 }
562598
563599 [ TestMethod ]
564- public async Task SimpleProperty_Multiple_OnlyTriggersOnSecondOne ( )
600+ #if ROSLYN_5_0_0_OR_GREATER
601+ [ DataRow ( LanguageVersion . CSharp14 ) ]
602+ #endif
603+ [ DataRow ( LanguageVersion . Preview ) ]
604+ public async Task SimpleProperty_Multiple_OnlyTriggersOnSecondOne ( LanguageVersion languageVersion )
565605 {
566606 string original = """
567607 using CommunityToolkit.Mvvm.ComponentModel;
@@ -606,7 +646,7 @@ public string FirstName
606646 }
607647 """ ;
608648
609- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
649+ CSharpCodeFixTest test = new ( languageVersion )
610650 {
611651 TestCode = original ,
612652 FixedCode = @fixed ,
@@ -630,7 +670,11 @@ public string FirstName
630670 }
631671
632672 [ TestMethod ]
633- public async Task SimpleProperty_WithinPartialType ( )
673+ #if ROSLYN_5_0_0_OR_GREATER
674+ [ DataRow ( LanguageVersion . CSharp14 ) ]
675+ #endif
676+ [ DataRow ( LanguageVersion . Preview ) ]
677+ public async Task SimpleProperty_WithinPartialType ( LanguageVersion languageVersion )
634678 {
635679 string original = """
636680 using CommunityToolkit.Mvvm.ComponentModel;
@@ -659,7 +703,7 @@ public partial class SampleViewModel : ObservableObject
659703 }
660704 """ ;
661705
662- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
706+ CSharpCodeFixTest test = new ( languageVersion )
663707 {
664708 TestCode = original ,
665709 FixedCode = @fixed ,
@@ -683,7 +727,11 @@ public partial class SampleViewModel : ObservableObject
683727 }
684728
685729 [ TestMethod ]
686- public async Task SimpleProperty_WithinPartialType_Multiple ( )
730+ #if ROSLYN_5_0_0_OR_GREATER
731+ [ DataRow ( LanguageVersion . CSharp14 ) ]
732+ #endif
733+ [ DataRow ( LanguageVersion . Preview ) ]
734+ public async Task SimpleProperty_WithinPartialType_Multiple ( LanguageVersion languageVersion )
687735 {
688736 string original = """
689737 using CommunityToolkit.Mvvm.ComponentModel;
@@ -721,7 +769,7 @@ public partial class SampleViewModel : ObservableObject
721769 }
722770 """ ;
723771
724- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
772+ CSharpCodeFixTest test = new ( languageVersion )
725773 {
726774 TestCode = original ,
727775 FixedCode = @fixed ,
@@ -751,7 +799,11 @@ public partial class SampleViewModel : ObservableObject
751799 }
752800
753801 [ TestMethod ]
754- public async Task SimpleProperty_Multiple_WithMissingUsingDirective ( )
802+ #if ROSLYN_5_0_0_OR_GREATER
803+ [ DataRow ( LanguageVersion . CSharp14 ) ]
804+ #endif
805+ [ DataRow ( LanguageVersion . Preview ) ]
806+ public async Task SimpleProperty_Multiple_WithMissingUsingDirective ( LanguageVersion languageVersion )
755807 {
756808 string original = """
757809 namespace MyApp;
@@ -796,7 +848,7 @@ public partial class SampleViewModel : CommunityToolkit.Mvvm.ComponentModel.Obse
796848 }
797849 """ ;
798850
799- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
851+ CSharpCodeFixTest test = new ( languageVersion )
800852 {
801853 TestCode = original ,
802854 FixedCode = @fixed ,
@@ -832,7 +884,11 @@ public partial class SampleViewModel : CommunityToolkit.Mvvm.ComponentModel.Obse
832884 }
833885
834886 [ TestMethod ]
835- public async Task SimpleProperty_WithinPartialType_Multiple_MixedScenario ( )
887+ #if ROSLYN_5_0_0_OR_GREATER
888+ [ DataRow ( LanguageVersion . CSharp14 ) ]
889+ #endif
890+ [ DataRow ( LanguageVersion . Preview ) ]
891+ public async Task SimpleProperty_WithinPartialType_Multiple_MixedScenario ( LanguageVersion languageVersion )
836892 {
837893 string original = """
838894 using System;
@@ -945,7 +1001,7 @@ public partial class SampleViewModel : ObservableObject
9451001 public class TestAttribute(string text) : Attribute;
9461002 """ ;
9471003
948- CSharpCodeFixTest test = new ( LanguageVersion . Preview )
1004+ CSharpCodeFixTest test = new ( languageVersion )
9491005 {
9501006 TestCode = original ,
9511007 FixedCode = @fixed ,
0 commit comments