@@ -18,14 +18,15 @@ public async Task A_field_or_property_not_annotated_with_the_paramsallvalues_att
1818 [ CombinatorialMemberData ( nameof ( FieldOrPropertyDeclarations ) ) ] string fieldOrPropertyDeclaration ,
1919 [ CombinatorialMemberData ( nameof ( InvalidTypes ) ) ] string invalidType )
2020 {
21- var testCode =
22- /* lang=c#-test */ $@ " using BenchmarkDotNet.Attributes;
21+ var testCode = /* lang=c#-test */ $$ """
22+ using BenchmarkDotNet.Attributes;
2323
24- public class BenchmarkClass
25- {{
26- { missingParamsAttributeUsage }
27- public { invalidType } { fieldOrPropertyDeclaration }
28- }}" ;
24+ public class BenchmarkClass
25+ {
26+ {{ missingParamsAttributeUsage }}
27+ public {{ invalidType }} {{ fieldOrPropertyDeclaration }}
28+ }
29+ """ ;
2930
3031 TestCode = testCode ;
3132 ReferenceDummyAttribute ( ) ;
@@ -50,9 +51,9 @@ public class BenchmarkClass
5051 "uint" ,
5152 "ulong" ,
5253 "ushort" ,
53-
54+
5455 "DummyEnumWithFlagsAttribute" ,
55-
56+
5657 "object" ,
5758 "System.Type"
5859 } ;
@@ -65,14 +66,15 @@ public NotAllowedOnFlagsEnumPropertyOrFieldType() : base(ParamsAllValuesAttribut
6566 [ Theory , CombinatorialData ]
6667 public async Task A_field_or_property_of_nonnullable_nonenum_type_should_not_trigger_diagnostic ( [ CombinatorialMemberData ( nameof ( FieldOrPropertyDeclarations ) ) ] string fieldOrPropertyDeclaration , [ CombinatorialMemberData ( nameof ( NonEnumTypes ) ) ] string nonEnumType )
6768 {
68- var testCode =
69- /* lang=c#-test */ $@ " using BenchmarkDotNet.Attributes;
69+ var testCode = /* lang=c#-test */ $$ """
70+ using BenchmarkDotNet.Attributes;
7071
71- public class BenchmarkClass
72- {{
73- [ParamsAllValues]
74- public { nonEnumType } { fieldOrPropertyDeclaration }
75- }}" ;
72+ public class BenchmarkClass
73+ {
74+ [ParamsAllValues]
75+ public {{ nonEnumType }} {{ fieldOrPropertyDeclaration }}
76+ }
77+ """ ;
7678
7779 TestCode = testCode ;
7880
@@ -82,14 +84,15 @@ public class BenchmarkClass
8284 [ Theory , CombinatorialData ]
8385 public async Task A_field_or_property_of_nullable_nonenum_type_should_not_trigger_diagnostic ( bool isNullable , [ CombinatorialMemberData ( nameof ( FieldOrPropertyDeclarations ) ) ] string fieldOrPropertyDeclaration , [ CombinatorialMemberData ( nameof ( NonEnumStructs ) ) ] string nonEnumType )
8486 {
85- var testCode =
86- /* lang=c#-test */ $@ " using BenchmarkDotNet.Attributes;
87+ var testCode = /* lang=c#-test */ $$ """
88+ using BenchmarkDotNet.Attributes;
8789
88- public class BenchmarkClass
89- {{
90- [ParamsAllValues]
91- public { nonEnumType } { ( isNullable ? "?" : "" ) } { fieldOrPropertyDeclaration }
92- }}" ;
90+ public class BenchmarkClass
91+ {
92+ [ParamsAllValues]
93+ public {{ nonEnumType }} {{ ( isNullable ? "?" : "" ) }} {{ fieldOrPropertyDeclaration }}
94+ }
95+ """ ;
9396
9497 TestCode = testCode ;
9598
@@ -99,14 +102,15 @@ public class BenchmarkClass
99102 [ Theory , CombinatorialData ]
100103 public async Task A_field_or_property_of_enum_type_without_a_flags_attribute_should_not_trigger_diagnostic ( bool isNullable , [ CombinatorialMemberData ( nameof ( FieldOrPropertyDeclarations ) ) ] string fieldOrPropertyDeclaration )
101104 {
102- var testCode =
103- /* lang=c#-test */ $@ " using BenchmarkDotNet.Attributes;
105+ var testCode = /* lang=c#-test */ $$ """
106+ using BenchmarkDotNet.Attributes;
104107
105- public class BenchmarkClass
106- {{
107- [ParamsAllValues]
108- public DummyEnum{ ( isNullable ? "?" : "" ) } { fieldOrPropertyDeclaration }
109- }}" ;
108+ public class BenchmarkClass
109+ {
110+ [ParamsAllValues]
111+ public DummyEnum{{ ( isNullable ? "?" : "" ) }} {{ fieldOrPropertyDeclaration }}
112+ }
113+ """ ;
110114
111115 TestCode = testCode ;
112116 ReferenceDummyEnum ( ) ;
@@ -119,14 +123,15 @@ public async Task A_field_or_property_of_enum_type_with_a_flags_attribute_should
119123 {
120124 const string enumTypeName = "DummyEnumWithFlagsAttribute" ;
121125
122- var testCode =
123- /* lang=c#-test */ $@ " using BenchmarkDotNet.Attributes;
126+ var testCode = /* lang=c#-test */ $$ """
127+ using BenchmarkDotNet.Attributes;
124128
125- public class BenchmarkClass
126- {{
127- [ParamsAllValues]
128- public {{|#0:{ enumTypeName } |}}{ ( isNullable ? "?" : "" ) } { fieldOrPropertyDeclaration }
129- }}" ;
129+ public class BenchmarkClass
130+ {
131+ [ParamsAllValues]
132+ public {|#0:{{ enumTypeName }} |}{{ ( isNullable ? "?" : "" ) }} {{ fieldOrPropertyDeclaration }}
133+ }
134+ """ ;
130135
131136 TestCode = testCode ;
132137 ReferenceDummyEnumWithFlagsAttribute ( ) ;
@@ -152,7 +157,7 @@ public class BenchmarkClass
152157 "ushort" ,
153158 } . AsReadOnly ( ) ;
154159
155- public static IEnumerable < string > NonEnumTypes => NonEnumStructs . Concat ( new [ ] { "string" , "object" , "System.Type" } ) ;
160+ public static IEnumerable < string > NonEnumTypes => NonEnumStructs . Concat ( [ "string" , "object" , "System.Type" ] ) ;
156161 }
157162
158163 public class PropertyOrFieldTypeMustBeEnumOrBool : AnalyzerTestFixture < ParamsAllValuesAttributeAnalyzer >
@@ -162,14 +167,15 @@ public PropertyOrFieldTypeMustBeEnumOrBool() : base(ParamsAllValuesAttributeAnal
162167 [ Theory , CombinatorialData ]
163168 public async Task A_field_or_property_of_enum_or_bool_type_should_not_trigger_diagnostic ( bool isNullable , [ CombinatorialValues ( "DummyEnum" , "bool" ) ] string enumOrBoolType , [ CombinatorialMemberData ( nameof ( FieldOrPropertyDeclarations ) ) ] string fieldOrPropertyDeclaration )
164169 {
165- var testCode =
166- /* lang=c#-test */ $@ " using BenchmarkDotNet.Attributes;
170+ var testCode = /* lang=c#-test */ $$ """
171+ using BenchmarkDotNet.Attributes;
167172
168- public class BenchmarkClass
169- {{
170- [ParamsAllValues]
171- public { enumOrBoolType } { ( isNullable ? "?" : "" ) } { fieldOrPropertyDeclaration }
172- }}" ;
173+ public class BenchmarkClass
174+ {
175+ [ParamsAllValues]
176+ public {{ enumOrBoolType }} {{ ( isNullable ? "?" : "" ) }} {{ fieldOrPropertyDeclaration }}
177+ }
178+ """ ;
173179
174180 TestCode = testCode ;
175181 ReferenceDummyEnum ( ) ;
@@ -180,14 +186,15 @@ public class BenchmarkClass
180186 [ Theory , CombinatorialData ]
181187 public async Task A_field_or_property_not_of_nonnullable_enum_or_bool_type_should_trigger_diagnostic ( [ CombinatorialMemberData ( nameof ( NonEnumOrBoolTypes ) ) ] string nonEnumOrBoolType , [ CombinatorialMemberData ( nameof ( FieldOrPropertyDeclarations ) ) ] string fieldOrPropertyDeclaration )
182188 {
183- var testCode =
184- /* lang=c#-test */ $@ " using BenchmarkDotNet.Attributes;
189+ var testCode = /* lang=c#-test */ $$ """
190+ using BenchmarkDotNet.Attributes;
185191
186- public class BenchmarkClass
187- {{
188- [ParamsAllValues]
189- public {{|#0:{ nonEnumOrBoolType } |}} { fieldOrPropertyDeclaration }
190- }}" ;
192+ public class BenchmarkClass
193+ {
194+ [ParamsAllValues]
195+ public {|#0:{{ nonEnumOrBoolType }} |} {{ fieldOrPropertyDeclaration }}
196+ }
197+ """ ;
191198
192199 TestCode = testCode ;
193200 ReferenceDummyEnum ( ) ;
@@ -199,14 +206,15 @@ public class BenchmarkClass
199206 [ Theory , CombinatorialData ]
200207 public async Task A_field_or_property_not_of_nullable_enum_or_bool_type_should_trigger_diagnostic ( bool isNullable , [ CombinatorialMemberData ( nameof ( NonEnumOrBoolStructs ) ) ] string nonEnumOrBoolType , [ CombinatorialMemberData ( nameof ( FieldOrPropertyDeclarations ) ) ] string fieldOrPropertyDeclaration )
201208 {
202- var testCode =
203- /* lang=c#-test */ $@ " using BenchmarkDotNet.Attributes;
209+ var testCode = /* lang=c#-test */ $$ """
210+ using BenchmarkDotNet.Attributes;
204211
205- public class BenchmarkClass
206- {{
207- [ParamsAllValues]
208- public {{|#0:{ nonEnumOrBoolType } |}}{ ( isNullable ? "?" : "" ) } { fieldOrPropertyDeclaration }
209- }}" ;
212+ public class BenchmarkClass
213+ {
214+ [ParamsAllValues]
215+ public {|#0:{{ nonEnumOrBoolType }} |}{{ ( isNullable ? "?" : "" ) }} {{ fieldOrPropertyDeclaration }}
216+ }
217+ """ ;
210218
211219 TestCode = testCode ;
212220 ReferenceDummyEnum ( ) ;
@@ -231,7 +239,11 @@ public class BenchmarkClass
231239 "ushort"
232240 } . AsReadOnly ( ) ;
233241
234- public static IEnumerable < string > NonEnumOrBoolTypes => NonEnumOrBoolStructs . Concat ( new [ ] { "string" , "object" , "System.Type" } ) ;
242+ public static IEnumerable < string > NonEnumOrBoolTypes => NonEnumOrBoolStructs . Concat ( [
243+ "string" ,
244+ "object" ,
245+ "System.Type"
246+ ] ) ;
235247 }
236248 }
237249}
0 commit comments