You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix CS1902: Invalid option 'portable' and MSB3245: Could not resolve System.Web.Entity for Mac VS Community edition
* Add FilterNullValues
* Add #region's to OptimizelyTest.cs
* Add TestActivateWithNullAttributes
* Moved TestInvalidDispatchImpressionEvent into different #region
* OASIS-1806 [C#] Prune null/nil/None value attributes in track activate
Summary:
[C#] Prune null/nil/None value attributes in track activate
Remove null attribute and eventTag values inputted to activate and track.
JSON's sent to OPTIMIZELY.COM should not contain null's.
Fix CS1902: Invalid option 'portable' and MSB3245: Could not resolve System.Web.Entity for Mac VS Community edition
Add FilterNullValues
Add #region's to OptimizelyTest.cs
Add TestActivateWithNullAttributes
Moved TestInvalidDispatchImpressionEvent into different #region
Add TestTrackWithNullAttributesWithNullEventValue
Test Plan:
"Unit Tests" / "Run All"
Passed: 92 Failed: 0
incluing our 2 new tests Add'ed above.
Reviewers: mike.ng, matthew.auerbach
JIRA Issues: OASIS-1806
Differential Revision: https://phabricator.optimizely.com/D17725
LoggerMock.Verify(l =>l.Log(LogLevel.DEBUG,"Assigned bucket [3037] to user [test_user]"),Times.Once);
375
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"User [test_user] is in variation [control] of experiment [test_experiment]."),Times.Once);
376
+
LoggerMock.Verify(l =>l.Log(LogLevel.ERROR,"[UserAttributes] Null value for key null_value removed and will not be sent to results."),Times.Once);
377
+
LoggerMock.Verify(l =>l.Log(LogLevel.ERROR,"[UserAttributes] Null value for key wont_be_sent removed and will not be sent to results."),Times.Once);
378
+
LoggerMock.Verify(l =>l.Log(LogLevel.ERROR,"[UserAttributes] Null value for key bad_food removed and will not be sent to results."),Times.Once);
379
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"Activating user test_user in experiment test_experiment."),Times.Once);
380
+
LoggerMock.Verify(l =>l.Log(LogLevel.DEBUG,"Dispatching impression event to URL OptimizelySDK.Event.LogEvent with params {\"param1\":\"val1\"}."),Times.Once);
381
+
382
+
Assert.AreEqual("control",variationkey);
383
+
}
384
+
339
385
[Test]
340
386
publicvoidTestActivateExperimentNotRunning()
341
387
{
@@ -353,7 +399,9 @@ public void TestActivateExperimentNotRunning()
LoggerMock.Verify(l =>l.Log(LogLevel.ERROR,"Datafile has invalid format. Failing 'track'."),Times.Once);
425
472
}
473
+
#endregion
426
474
475
+
#region Test Track
427
476
[Test]
428
477
publicvoidTestTrackInvalidAttributes()
429
478
{
@@ -528,6 +577,45 @@ public void TestTrackWithAttributesWithEventValue()
528
577
LoggerMock.Verify(l =>l.Log(LogLevel.DEBUG,"Dispatching conversion event to URL logx.optimizely.com/track with params {\"param1\":\"val1\"}."),Times.Once);
LoggerMock.Verify(l =>l.Log(LogLevel.DEBUG,"Assigned bucket [3037] to user [test_user]"));
598
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"User [test_user] is in variation [control] of experiment [test_experiment]."));
599
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"This decision will not be saved since the UserProfileService is null."));
600
+
LoggerMock.Verify(l =>l.Log(LogLevel.DEBUG,"Assigned bucket [4517] to user [test_user]"));
601
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"User [test_user] is not in experiment [group_experiment_1] of group [7722400015]."));
602
+
LoggerMock.Verify(l =>l.Log(LogLevel.DEBUG,"Assigned bucket [4517] to user [test_user]"));
603
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"User [test_user] is in experiment [group_experiment_2] of group [7722400015]."));
604
+
LoggerMock.Verify(l =>l.Log(LogLevel.DEBUG,"Assigned bucket [9871] to user [test_user]"));
605
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"User [test_user] is in variation [group_exp_2_var_2] of experiment [group_experiment_2]."));
606
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"This decision will not be saved since the UserProfileService is null."));
607
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"Experiment \"paused_experiment\" is not running."));
608
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"Not tracking user \"test_user\" for experiment \"paused_experiment\""));
609
+
LoggerMock.Verify(l =>l.Log(LogLevel.ERROR,"[UserAttributes] Null value for key null_value removed and will not be sent to results."));
610
+
LoggerMock.Verify(l =>l.Log(LogLevel.ERROR,"[UserAttributes] Null value for key wont_be_sent removed and will not be sent to results."));
611
+
LoggerMock.Verify(l =>l.Log(LogLevel.ERROR,"[UserAttributes] Null value for key bad_food removed and will not be sent to results."));
612
+
LoggerMock.Verify(l =>l.Log(LogLevel.ERROR,"[EventTags] Null value for key wont_send_null removed and will not be sent to results."));
613
+
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"Tracking event purchase for user test_user."));
614
+
LoggerMock.Verify(l =>l.Log(LogLevel.DEBUG,"Dispatching conversion event to URL logx.optimizely.com/track with params {\"param1\":\"val1\"}."));
615
+
}
616
+
#endregion
617
+
618
+
#region Test Invalid Dispatch
531
619
[Test]
532
620
publicvoidTestInvalidDispatchImpressionEvent()
533
621
{
@@ -571,7 +659,9 @@ public void TestInvalidDispatchConversionEvent()
571
659
LoggerMock.Verify(l =>l.Log(LogLevel.INFO,"Tracking event purchase for user test_user."),Times.Once);
572
660
LoggerMock.Verify(l =>l.Log(LogLevel.DEBUG,"Dispatching conversion event to URL logx.optimizely.com/track with params {\"param1\":\"val1\"}."),Times.Once);
0 commit comments