@@ -1547,13 +1547,15 @@ public void TestActivateListener(UserAttributes userAttributes)
15471547 DecisionServiceMock . Setup ( ds => ds . GetVariation ( experiment , TestUserId , userAttributes ) ) . Returns ( variation ) ;
15481548 DecisionServiceMock . Setup ( ds => ds . GetVariationForFeature ( featureFlag , TestUserId , userAttributes ) ) . Returns ( variation ) ;
15491549
1550+ var optly = Helper . CreatePrivateOptimizely ( ) ;
1551+ var optStronglyTyped = optly . GetObject ( ) as Optimizely ;
1552+
1553+
15501554 // Adding notification listeners.
15511555 var notificationType = NotificationCenter . NotificationType . Activate ;
1552- NotificationCenter . AddNotification ( notificationType , NotificationCallbackMock . Object . TestActivateCallback ) ;
1553- NotificationCenter . AddNotification ( notificationType , NotificationCallbackMock . Object . TestAnotherActivateCallback ) ;
1554-
1555- var optly = Helper . CreatePrivateOptimizely ( ) ;
1556- optly . SetFieldOrProperty ( "NotificationCenter" , NotificationCenter ) ;
1556+ optStronglyTyped . NotificationCenter . AddNotification ( notificationType , NotificationCallbackMock . Object . TestActivateCallback ) ;
1557+ optStronglyTyped . NotificationCenter . AddNotification ( notificationType , NotificationCallbackMock . Object . TestAnotherActivateCallback ) ;
1558+
15571559 optly . SetFieldOrProperty ( "DecisionService" , DecisionServiceMock . Object ) ;
15581560 optly . SetFieldOrProperty ( "EventBuilder" , EventBuilderMock . Object ) ;
15591561
@@ -1613,6 +1615,9 @@ public void TestTrackListener(UserAttributes userAttributes, EventTags eventTags
16131615 var logEvent = new LogEvent ( "https://logx.optimizely.com/v1/events" , OptimizelyHelper . SingleParameter ,
16141616 "POST" , new Dictionary < string , string > { } ) ;
16151617
1618+ var optly = Helper . CreatePrivateOptimizely ( ) ;
1619+ var optStronglyTyped = optly . GetObject ( ) as Optimizely ;
1620+
16161621 // Mocking objects.
16171622 NotificationCallbackMock . Setup ( nc => nc . TestTrackCallback ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ,
16181623 It . IsAny < UserAttributes > ( ) , It . IsAny < EventTags > ( ) , It . IsAny < LogEvent > ( ) ) ) ;
@@ -1625,11 +1630,9 @@ public void TestTrackListener(UserAttributes userAttributes, EventTags eventTags
16251630
16261631 // Adding notification listeners.
16271632 var notificationType = NotificationCenter . NotificationType . Track ;
1628- NotificationCenter . AddNotification ( notificationType , NotificationCallbackMock . Object . TestTrackCallback ) ;
1629- NotificationCenter . AddNotification ( notificationType , NotificationCallbackMock . Object . TestAnotherTrackCallback ) ;
1633+ optStronglyTyped . NotificationCenter . AddNotification ( notificationType , NotificationCallbackMock . Object . TestTrackCallback ) ;
1634+ optStronglyTyped . NotificationCenter . AddNotification ( notificationType , NotificationCallbackMock . Object . TestAnotherTrackCallback ) ;
16301635
1631- var optly = Helper . CreatePrivateOptimizely ( ) ;
1632- optly . SetFieldOrProperty ( "NotificationCenter" , NotificationCenter ) ;
16331636 optly . SetFieldOrProperty ( "DecisionService" , DecisionServiceMock . Object ) ;
16341637 optly . SetFieldOrProperty ( "EventBuilder" , EventBuilderMock . Object ) ;
16351638
0 commit comments