@@ -69,33 +69,41 @@ public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithFieldsIsCorrect(
69
69
var product = new Product
70
70
{
71
71
Name = "Red T-shirt" ,
72
+ Description = string . Empty ,
72
73
Price = 995.00
73
74
} ;
74
75
75
- const string updateCode = "product.Price *= 1.15;" ;
76
+ const string updateCode = @"product.Description = null;
77
+ product.Price *= 1.15;" ;
76
78
77
79
const string input1 = "product.Name" ;
78
80
const string targetOutput1 = "Red T-shirt" ;
79
81
80
- const string input2 = "product.Price" ;
81
- const double targetOutput2 = 1144.25 ;
82
+ const string input2 = "product.Description" ;
83
+ const string targetOutput2 = null ;
84
+
85
+ const string input3 = "product.Price" ;
86
+ const double targetOutput3 = 1144.25 ;
82
87
83
88
// Act
84
89
string output1 ;
85
- double output2 ;
90
+ string output2 ;
91
+ double output3 ;
86
92
87
93
using ( var jsEngine = CreateJsEngine ( ) )
88
94
{
89
95
jsEngine . EmbedHostObject ( "product" , product ) ;
90
96
jsEngine . Execute ( updateCode ) ;
91
97
92
98
output1 = jsEngine . Evaluate < string > ( input1 ) ;
93
- output2 = jsEngine . Evaluate < double > ( input2 ) ;
99
+ output2 = jsEngine . Evaluate < string > ( input2 ) ;
100
+ output3 = jsEngine . Evaluate < double > ( input3 ) ;
94
101
}
95
102
96
103
// Assert
97
104
Assert . AreEqual ( targetOutput1 , output1 ) ;
98
105
Assert . AreEqual ( targetOutput2 , output2 ) ;
106
+ Assert . AreEqual ( targetOutput3 , output3 ) ;
99
107
}
100
108
101
109
#endregion
@@ -218,17 +226,22 @@ public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithPropertiesIsCorr
218
226
{
219
227
// Arrange
220
228
var person = new Person ( "Vanya" , "Ivanov" ) ;
221
- const string updateCode = "person.LastName = person.LastName.substr(0, 5) + 'ff';" ;
229
+ const string updateCode = @"person.LastName = person.LastName.substr(0, 5) + 'ff';
230
+ person.Patronymic = null;" ;
222
231
223
232
const string input1 = "person.FirstName" ;
224
233
const string targetOutput1 = "Vanya" ;
225
234
226
235
const string input2 = "person.LastName" ;
227
236
const string targetOutput2 = "Ivanoff" ;
228
237
238
+ const string input3 = "person.Patronymic" ;
239
+ const string targetOutput3 = null ;
240
+
229
241
// Act
230
242
string output1 ;
231
243
string output2 ;
244
+ string output3 ;
232
245
233
246
using ( var jsEngine = CreateJsEngine ( ) )
234
247
{
@@ -237,11 +250,13 @@ public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithPropertiesIsCorr
237
250
238
251
output1 = jsEngine . Evaluate < string > ( input1 ) ;
239
252
output2 = jsEngine . Evaluate < string > ( input2 ) ;
253
+ output3 = jsEngine . Evaluate < string > ( input3 ) ;
240
254
}
241
255
242
256
// Assert
243
257
Assert . AreEqual ( targetOutput1 , output1 ) ;
244
258
Assert . AreEqual ( targetOutput2 , output2 ) ;
259
+ Assert . AreEqual ( targetOutput3 , output3 ) ;
245
260
}
246
261
247
262
[ Test ]
@@ -405,7 +420,7 @@ public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithMethodIsCorrect(
405
420
var fileManager = new FileManager ( ) ;
406
421
string filePath = GetAbsolutePath ( "SharedFiles/link.txt" ) ;
407
422
408
- string input = string . Format ( "fileManager.ReadFile('{0}')" , filePath . Replace ( @"\" , @"\\" ) ) ;
423
+ string input = string . Format ( "fileManager.ReadFile('{0}', null )" , filePath . Replace ( @"\" , @"\\" ) ) ;
409
424
const string targetOutput = "http://www.panopticoncentral.net/2015/09/09/the-two-faces-of-jsrt-in-windows-10/" ;
410
425
411
426
// Act
0 commit comments