@@ -92,6 +92,21 @@ public void TestTrackT()
92
92
Assert . Equal ( expectedEvent , actual [ 0 ] . Event ) ;
93
93
}
94
94
95
+ [ Fact ]
96
+ public void TestTrackTNullProperties ( )
97
+ {
98
+ string expectedEvent = "foo" ;
99
+ var actual = new List < TrackEvent > ( ) ;
100
+ _plugin . Setup ( o => o . Track ( Capture . In ( actual ) ) ) ;
101
+
102
+ _analytics . Add ( _plugin . Object ) ;
103
+ _analytics . Track ( expectedEvent , ( FooBar ) null ) ;
104
+
105
+ Assert . NotEmpty ( actual ) ;
106
+ Assert . True ( actual [ 0 ] . Properties . Count == 0 ) ;
107
+ Assert . Equal ( expectedEvent , actual [ 0 ] . Event ) ;
108
+ }
109
+
95
110
[ Fact ]
96
111
public void TestTrackTNoProperties ( )
97
112
{
@@ -166,6 +181,23 @@ public void TestIdentifyNoUserId()
166
181
Assert . Equal ( expectedUserId , actualUserId ) ;
167
182
}
168
183
184
+ [ Fact ]
185
+ public void TestIdentifyNoUserIdNullTraits ( )
186
+ {
187
+ var actual = new List < IdentifyEvent > ( ) ;
188
+ _plugin . Setup ( o => o . Identify ( Capture . In ( actual ) ) ) ;
189
+ string expectedUserId = _analytics . UserId ( ) ;
190
+
191
+ _analytics . Add ( _plugin . Object ) ;
192
+ _analytics . Identify ( ( JsonObject ) null ) ;
193
+
194
+ string actualUserId = _analytics . UserId ( ) ;
195
+
196
+ Assert . NotEmpty ( actual ) ;
197
+ Assert . True ( actual [ 0 ] . Traits . Count == 0 ) ;
198
+ Assert . Equal ( expectedUserId , actualUserId ) ;
199
+ }
200
+
169
201
[ Fact ]
170
202
public void TestIdentifyT ( )
171
203
{
@@ -184,6 +216,23 @@ public void TestIdentifyT()
184
216
Assert . Equal ( expectedUserId , actualUserId ) ;
185
217
}
186
218
219
+ [ Fact ]
220
+ public void TestIdentifyTNullTraits ( )
221
+ {
222
+ string expectedUserId = "newUserId" ;
223
+ var actual = new List < IdentifyEvent > ( ) ;
224
+ _plugin . Setup ( o => o . Identify ( Capture . In ( actual ) ) ) ;
225
+
226
+ _analytics . Add ( _plugin . Object ) ;
227
+ _analytics . Identify ( expectedUserId , ( FooBar ) null ) ;
228
+
229
+ string actualUserId = _analytics . UserId ( ) ;
230
+
231
+ Assert . NotEmpty ( actual ) ;
232
+ Assert . True ( actual [ 0 ] . Traits . Count == 0 ) ;
233
+ Assert . Equal ( expectedUserId , actualUserId ) ;
234
+ }
235
+
187
236
[ Fact ]
188
237
public void TestIdentifyTNoTraits ( )
189
238
{
@@ -192,7 +241,7 @@ public void TestIdentifyTNoTraits()
192
241
_plugin . Setup ( o => o . Identify ( Capture . In ( actual ) ) ) ;
193
242
194
243
_analytics . Add ( _plugin . Object ) ;
195
- _analytics . Identify ( expectedUserId ) ;
244
+ _analytics . Identify ( expectedUserId , ( FooBar ) null ) ;
196
245
string actualUserId = _analytics . UserId ( ) ;
197
246
198
247
Assert . NotEmpty ( actual ) ;
@@ -217,6 +266,21 @@ public void TestIdentifyTNoUserId()
217
266
Assert . Equal ( expectedUserId , actualUserId ) ;
218
267
}
219
268
269
+ [ Fact ]
270
+ public void TestIdentifyTNoUserIdNullTraits ( )
271
+ {
272
+ var actual = new List < IdentifyEvent > ( ) ;
273
+ _plugin . Setup ( o => o . Identify ( Capture . In ( actual ) ) ) ;
274
+ string expectedUserId = _analytics . UserId ( ) ;
275
+
276
+ _analytics . Add ( _plugin . Object ) ;
277
+ _analytics . Identify ( ( FooBar ) null ) ;
278
+ string actualUserId = _analytics . UserId ( ) ;
279
+
280
+ Assert . NotEmpty ( actual ) ;
281
+ Assert . True ( actual [ 0 ] . Traits . Count == 0 ) ;
282
+ Assert . Equal ( expectedUserId , actualUserId ) ;
283
+ }
220
284
221
285
[ Fact ]
222
286
public void TestIdentifyReload ( )
@@ -297,7 +361,7 @@ public void TestScreenTWithNulls()
297
361
_plugin . Setup ( o => o . Screen ( Capture . In ( actual ) ) ) ;
298
362
299
363
_analytics . Add ( _plugin . Object ) ;
300
- _analytics . Screen ( null , null , null ) ;
364
+ _analytics . Screen ( null , ( FooBar ) null , null ) ;
301
365
302
366
Assert . NotEmpty ( actual ) ;
303
367
Assert . True ( actual [ 0 ] . Properties . Count == 0 ) ;
@@ -369,7 +433,7 @@ public void TestPageTWithNulls()
369
433
_plugin . Setup ( o => o . Page ( Capture . In ( actual ) ) ) ;
370
434
371
435
_analytics . Add ( _plugin . Object ) ;
372
- _analytics . Page ( null , null , null ) ;
436
+ _analytics . Page ( null , ( FooBar ) null , null ) ;
373
437
374
438
Assert . NotEmpty ( actual ) ;
375
439
Assert . True ( actual [ 0 ] . Properties . Count == 0 ) ;
@@ -429,14 +493,14 @@ public void TestGroupT()
429
493
}
430
494
431
495
[ Fact ]
432
- public void TestGroupTNoProperties ( )
496
+ public void TestGroupTNullProperties ( )
433
497
{
434
498
string expectedGroupId = "foo" ;
435
499
var actual = new List < GroupEvent > ( ) ;
436
500
_plugin . Setup ( o => o . Group ( Capture . In ( actual ) ) ) ;
437
501
438
502
_analytics . Add ( _plugin . Object ) ;
439
- _analytics . Group ( expectedGroupId ) ;
503
+ _analytics . Group ( expectedGroupId , ( FooBar ) null ) ;
440
504
441
505
Assert . NotEmpty ( actual ) ;
442
506
Assert . True ( actual [ 0 ] . Traits . Count == 0 ) ;
0 commit comments