@@ -37,29 +37,38 @@ type WriteCodeFragmentFSharpTests() =
37
37
verifyAttribute " SomeAttribute" [( " _Parameter1" , " \" uno\" " )] " SomeAttribute(\"\\\" uno\\\"\" )"
38
38
39
39
[<Fact>]
40
- member _. ``Named parameters with IsLiteral suffix`` () =
41
- verifyAttribute " SomeAttribute" [( " Bool" , " true" ); ( " BoolIsLiteral " , " true" )] " SomeAttribute(Bool = true)"
40
+ member _. ``Named parameters with _IsLiteral suffix`` () =
41
+ verifyAttribute " SomeAttribute" [( " Bool" , " true" ); ( " Bool_IsLiteral " , " true" )] " SomeAttribute(Bool = true)"
42
42
43
43
[<Fact>]
44
- member _. ``Multiple named parameters with IsLiteral suffix`` () =
44
+ member _. ``Multiple named parameters with _IsLiteral suffix`` () =
45
45
verifyAttribute " SomeAttribute"
46
46
[
47
47
( " Number" , " 42" );
48
- ( " NumberIsLiteral " , " true" );
48
+ ( " Number_IsLiteral " , " true" );
49
49
( " Bool" , " false" );
50
- ( " BoolIsLiteral " , " true" )
50
+ ( " Bool_IsLiteral " , " true" )
51
51
]
52
52
" SomeAttribute(Number = 42, Bool = false)"
53
53
54
54
[<Fact>]
55
- member _. ``Mixed named parameters with and without IsLiteral suffix`` () =
55
+ member _. ``Mixed named parameters with and without _IsLiteral suffix`` () =
56
56
verifyAttribute " SomeAttribute"
57
57
[
58
58
( " Number" , " 42" );
59
- ( " NumberIsLiteral " , " true" );
59
+ ( " Number_IsLiteral " , " true" );
60
60
( " Text" , " hello" )
61
61
]
62
62
" SomeAttribute(Number = 42, Text = \" hello\" )"
63
+
64
+ [<Fact>]
65
+ member _. ``Enum _IsLiteral suffix`` () =
66
+ verifyAttribute " SomeAttribute"
67
+ [
68
+ ( " EnumValue" , " System.StringComparison.OrdinalIgnoreCase" );
69
+ ( " EnumValue_IsLiteral" , " true" )
70
+ ]
71
+ " SomeAttribute(EnumValue = System.StringComparison.OrdinalIgnoreCase)"
63
72
64
73
type WriteCodeFragmentCSharpTests () =
65
74
@@ -70,31 +79,6 @@ type WriteCodeFragmentCSharpTests() =
70
79
let fullExpectedAttributeText = " [assembly: " + expectedAttributeText + " ]"
71
80
Assert.Equal( fullExpectedAttributeText, actualAttributeText)
72
81
73
- [<Fact>]
74
- member _. ``Named parameters with IsLiteral suffix`` () =
75
- verifyAttribute " SomeAttribute" [( " Bool" , " true" ); ( " BoolIsLiteral" , " true" )] " SomeAttribute(Bool = true)"
76
-
77
- [<Fact>]
78
- member _. ``Multiple named parameters with IsLiteral suffix`` () =
79
- verifyAttribute " SomeAttribute"
80
- [
81
- ( " Number" , " 42" );
82
- ( " NumberIsLiteral" , " true" );
83
- ( " Bool" , " false" );
84
- ( " BoolIsLiteral" , " true" )
85
- ]
86
- " SomeAttribute(Number = 42, Bool = false)"
87
-
88
- [<Fact>]
89
- member _. ``Mixed named parameters with and without IsLiteral suffix`` () =
90
- verifyAttribute " SomeAttribute"
91
- [
92
- ( " Number" , " 42" );
93
- ( " NumberIsLiteral" , " true" );
94
- ( " Text" , " hello" )
95
- ]
96
- " SomeAttribute(Number = 42, Text = \" hello\" )"
97
-
98
82
[<Fact>]
99
83
member _. ``No parameters`` () =
100
84
verifyAttribute " SomeAttribute" [] " SomeAttribute()"
@@ -115,6 +99,40 @@ type WriteCodeFragmentCSharpTests() =
115
99
member _. ``Escaped string parameters`` () =
116
100
verifyAttribute " SomeAttribute" [( " _Parameter1" , " \" uno\" " )] " SomeAttribute(\"\\\" uno\\\"\" )"
117
101
// this should look like: SomeAttribute("\"uno\"")
102
+
103
+ [<Fact>]
104
+ member _. ``Named parameters with _IsLiteral suffix`` () =
105
+ verifyAttribute " SomeAttribute" [( " Bool" , " true" ); ( " Bool_IsLiteral" , " true" )] " SomeAttribute(Bool = true)"
106
+
107
+ [<Fact>]
108
+ member _. ``Multiple named parameters with _IsLiteral suffix`` () =
109
+ verifyAttribute " SomeAttribute"
110
+ [
111
+ ( " Number" , " 42" );
112
+ ( " Number_IsLiteral" , " true" );
113
+ ( " Bool" , " false" );
114
+ ( " Bool_IsLiteral" , " true" )
115
+ ]
116
+ " SomeAttribute(Number = 42, Bool = false)"
117
+
118
+ [<Fact>]
119
+ member _. ``Mixed named parameters with and without _IsLiteral suffix`` () =
120
+ verifyAttribute " SomeAttribute"
121
+ [
122
+ ( " Number" , " 42" );
123
+ ( " Number_IsLiteral" , " true" );
124
+ ( " Text" , " hello" )
125
+ ]
126
+ " SomeAttribute(Number = 42, Text = \" hello\" )"
127
+
128
+ [<Fact>]
129
+ member _. ``Enum _IsLiteral suffix`` () =
130
+ verifyAttribute " SomeAttribute"
131
+ [
132
+ ( " EnumValue" , " System.StringComparison.OrdinalIgnoreCase" );
133
+ ( " EnumValue_IsLiteral" , " true" )
134
+ ]
135
+ " SomeAttribute(EnumValue = System.StringComparison.OrdinalIgnoreCase)"
118
136
119
137
120
138
type WriteCodeFragmentVisualBasicTests () =
@@ -148,27 +166,36 @@ type WriteCodeFragmentVisualBasicTests() =
148
166
// this should look like: SomeAttribute("\"uno\"")
149
167
150
168
[<Fact>]
151
- member _. ``Named parameters with IsLiteral suffix`` () =
152
- verifyAttribute " SomeAttribute" [( " Bool" , " true" ); ( " BoolIsLiteral " , " true" )] " SomeAttribute(Bool = true)"
169
+ member _. ``Named parameters with _IsLiteral suffix`` () =
170
+ verifyAttribute " SomeAttribute" [( " Bool" , " true" ); ( " Bool_IsLiteral " , " true" )] " SomeAttribute(Bool = true)"
153
171
154
172
[<Fact>]
155
- member _. ``Multiple named parameters with IsLiteral suffix`` () =
173
+ member _. ``Multiple named parameters with _IsLiteral suffix`` () =
156
174
verifyAttribute " SomeAttribute"
157
175
[
158
176
( " Number" , " 42" );
159
- ( " NumberIsLiteral " , " true" );
177
+ ( " Number_IsLiteral " , " true" );
160
178
( " Bool" , " false" );
161
- ( " BoolIsLiteral " , " true" )
179
+ ( " Bool_IsLiteral " , " true" )
162
180
]
163
181
" SomeAttribute(Number = 42, Bool = false)"
164
182
165
183
[<Fact>]
166
- member _. ``Mixed named parameters with and without IsLiteral suffix`` () =
184
+ member _. ``Mixed named parameters with and without _IsLiteral suffix`` () =
167
185
verifyAttribute " SomeAttribute"
168
186
[
169
187
( " Number" , " 42" );
170
- ( " NumberIsLiteral " , " true" );
188
+ ( " Number_IsLiteral " , " true" );
171
189
( " Text" , " hello" )
172
190
]
173
191
" SomeAttribute(Number = 42, Text = \" hello\" )"
192
+
193
+ [<Fact>]
194
+ member _. ``Enum _IsLiteral suffix`` () =
195
+ verifyAttribute " SomeAttribute"
196
+ [
197
+ ( " EnumValue" , " System.StringComparison.OrdinalIgnoreCase" );
198
+ ( " EnumValue_IsLiteral" , " true" )
199
+ ]
200
+ " SomeAttribute(EnumValue = System.StringComparison.OrdinalIgnoreCase)"
174
201
0 commit comments