File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 3
3
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
4
4
5
5
using System ;
6
+ using System . Dynamic ;
6
7
using System . Globalization ;
7
8
using System . Threading . Tasks ;
8
9
using Xunit ;
@@ -207,5 +208,30 @@ public async Task ShouldEchoDateTimeNow()
207
208
208
209
output . WriteLine ( "Expected {0} : Actual {1}" , expectedDateTime , actualDateTime ) ;
209
210
}
211
+
212
+ [ Fact ]
213
+ public async Task ShouldWorkWithExpandoObject ( )
214
+ {
215
+ AssertInitialLoadComplete ( ) ;
216
+
217
+ var expectedDateTime = DateTime . Now ;
218
+
219
+ dynamic request = new ExpandoObject ( ) ;
220
+ request . dateTime = expectedDateTime ;
221
+
222
+ var javascriptResponse = await Browser . EvaluateScriptAsync ( "(function(p) { return p; })" ) ;
223
+ Assert . True ( javascriptResponse . Success ) ;
224
+
225
+ var callback = ( IJavascriptCallback ) javascriptResponse . Result ;
226
+
227
+ var callbackResponse = await callback . ExecuteAsync ( request ) ;
228
+
229
+ dynamic response = callbackResponse . Result ;
230
+ var actualDateTime = ( DateTime ) response . dateTime ;
231
+
232
+ Assert . Equal ( expectedDateTime , actualDateTime , TimeSpan . FromMilliseconds ( 10 ) ) ;
233
+
234
+ output . WriteLine ( "Expected {0} : Actual {1}" , expectedDateTime , actualDateTime ) ;
235
+ }
210
236
}
211
237
}
You can’t perform that action at this time.
0 commit comments