@@ -158,6 +158,25 @@ public void Vb_CompareLambdas()
158158 validationResults . Errors [ 0 ] . Message . ShouldContain ( "A null propagating operator cannot be converted into an expression tree." ) ;
159159 }
160160
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+
161180 [ Fact ]
162181 public void Vb_LambdaExtension ( )
163182 {
@@ -172,6 +191,20 @@ public void Vb_LambdaExtension()
172191 validationResults . Errors . Count . ShouldBe ( 0 , string . Join ( "\n " , validationResults . Errors . Select ( e => e . Message ) ) ) ;
173192 }
174193
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+
175208 [ Fact ]
176209 public void Vb_Dictionary ( )
177210 {
@@ -185,6 +218,20 @@ public void Vb_Dictionary()
185218 ValidationResults validationResults = ActivityValidationServices . Validate ( workflow , _useValidator ) ;
186219 validationResults . Errors . Count . ShouldBe ( 0 , string . Join ( "\n " , validationResults . Errors . Select ( e => e . Message ) ) ) ;
187220 }
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+ }
188235 #region Check locations are not readonly
189236 [ Fact ]
190237 public void VB_Readonly_ThrowsError ( )
@@ -291,6 +338,20 @@ public void Vb_IntOverflow()
291338 validationResults . Errors [ 0 ] . Message . ShouldContain ( "Constant expression not representable in type 'Integer'" ) ;
292339 }
293340
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+
294355 [ Fact ]
295356 public void VBValidator_StrictOn ( )
296357 {
0 commit comments