@@ -158,6 +158,25 @@ public void Vb_CompareLambdas()
158
158
validationResults . Errors [ 0 ] . Message . ShouldContain ( "A null propagating operator cannot be converted into an expression tree." ) ;
159
159
}
160
160
161
+ [ Fact ]
162
+ public void Cs_CompareLambdas ( )
163
+ {
164
+ CSharpValue < string > csv = new ( @$ "string.Concat(""alpha "", b?.Substring(0, 10), ""beta "", 1)") ;
165
+ WriteLine writeLine = new ( ) ;
166
+ writeLine . Text = new InArgument < string > ( csv ) ;
167
+ Sequence workflow = new ( ) ;
168
+ workflow . Activities . Add ( writeLine ) ;
169
+ workflow . Variables . Add ( new Variable < string > ( "b" , "I'm a variable" ) ) ;
170
+
171
+ ValidationResults validationResults = ActivityValidationServices . Validate ( workflow , _forceCache ) ;
172
+ validationResults . Errors . Count . ShouldBe ( 1 , string . Join ( "\n " , validationResults . Errors . Select ( e => e . Message ) ) ) ;
173
+ validationResults . Errors [ 0 ] . Message . ShouldContain ( "An expression tree lambda may not contain a null propagating operator." ) ;
174
+
175
+ validationResults = ActivityValidationServices . Validate ( workflow , _useValidator ) ;
176
+ validationResults . Errors . Count . ShouldBe ( 1 , string . Join ( "\n " , validationResults . Errors . Select ( e => e . Message ) ) ) ;
177
+ validationResults . Errors [ 0 ] . Message . ShouldContain ( "An expression tree lambda may not contain a null propagating operator." ) ;
178
+ }
179
+
161
180
[ Fact ]
162
181
public void Vb_LambdaExtension ( )
163
182
{
@@ -172,6 +191,20 @@ public void Vb_LambdaExtension()
172
191
validationResults . Errors . Count . ShouldBe ( 0 , string . Join ( "\n " , validationResults . Errors . Select ( e => e . Message ) ) ) ;
173
192
}
174
193
194
+ [ Fact ]
195
+ public void Cs_LambdaExtension ( )
196
+ {
197
+ CSharpValue < string > csv = new ( "list.First()" ) ;
198
+ WriteLine writeLine = new ( ) ;
199
+ writeLine . Text = new InArgument < string > ( csv ) ;
200
+ Sequence workflow = new ( ) ;
201
+ workflow . Activities . Add ( writeLine ) ;
202
+ workflow . Variables . Add ( new Variable < List < string > > ( "list" ) ) ;
203
+
204
+ ValidationResults validationResults = ActivityValidationServices . Validate ( workflow , _useValidator ) ;
205
+ validationResults . Errors . Count . ShouldBe ( 0 , string . Join ( "\n " , validationResults . Errors . Select ( e => e . Message ) ) ) ;
206
+ }
207
+
175
208
[ Fact ]
176
209
public void Vb_Dictionary ( )
177
210
{
@@ -185,6 +218,20 @@ public void Vb_Dictionary()
185
218
ValidationResults validationResults = ActivityValidationServices . Validate ( workflow , _useValidator ) ;
186
219
validationResults . Errors . Count . ShouldBe ( 0 , string . Join ( "\n " , validationResults . Errors . Select ( e => e . Message ) ) ) ;
187
220
}
221
+
222
+ [ Fact ]
223
+ public void Cs_Dictionary ( )
224
+ {
225
+ CSharpValue < string > csv = new ( "something.FooDictionary[\" key\" ].ToString()" ) ;
226
+ WriteLine writeLine = new ( ) ;
227
+ writeLine . Text = new InArgument < string > ( csv ) ;
228
+ Sequence workflow = new ( ) ;
229
+ workflow . Activities . Add ( writeLine ) ;
230
+ workflow . Variables . Add ( new Variable < ClassWithCollectionProperties > ( "something" ) ) ;
231
+
232
+ ValidationResults validationResults = ActivityValidationServices . Validate ( workflow , _useValidator ) ;
233
+ validationResults . Errors . Count . ShouldBe ( 0 , string . Join ( "\n " , validationResults . Errors . Select ( e => e . Message ) ) ) ;
234
+ }
188
235
#region Check locations are not readonly
189
236
[ Fact ]
190
237
public void VB_Readonly_ThrowsError ( )
@@ -291,6 +338,20 @@ public void Vb_IntOverflow()
291
338
validationResults . Errors [ 0 ] . Message . ShouldContain ( "Constant expression not representable in type 'Integer'" ) ;
292
339
}
293
340
341
+ [ Fact ]
342
+ public void Cs_IntOverflow ( )
343
+ {
344
+ VisualBasicValue < int > csv = new ( "2147483648" ) ;
345
+ Sequence workflow = new ( ) ;
346
+ workflow . Variables . Add ( new Variable < int > ( "someint" ) ) ;
347
+ Assign assign = new ( ) { To = new OutArgument < int > ( workflow . Variables [ 0 ] ) , Value = new InArgument < int > ( csv ) } ;
348
+ workflow . Activities . Add ( assign ) ;
349
+
350
+ ValidationResults validationResults = ActivityValidationServices . Validate ( workflow , _useValidator ) ;
351
+ validationResults . Errors . Count . ShouldBe ( 1 , string . Join ( "\n " , validationResults . Errors . Select ( e => e . Message ) ) ) ;
352
+ validationResults . Errors [ 0 ] . Message . ShouldContain ( "Constant expression not representable in type 'Integer'" ) ;
353
+ }
354
+
294
355
[ Fact ]
295
356
public void VBValidator_StrictOn ( )
296
357
{
0 commit comments