@@ -1547,13 +1547,15 @@ public void TestActivateListener(UserAttributes userAttributes)
1547
1547
DecisionServiceMock . Setup ( ds => ds . GetVariation ( experiment , TestUserId , userAttributes ) ) . Returns ( variation ) ;
1548
1548
DecisionServiceMock . Setup ( ds => ds . GetVariationForFeature ( featureFlag , TestUserId , userAttributes ) ) . Returns ( variation ) ;
1549
1549
1550
+ var optly = Helper . CreatePrivateOptimizely ( ) ;
1551
+ var optStronglyTyped = optly . GetObject ( ) as Optimizely ;
1552
+
1553
+
1550
1554
// Adding notification listeners.
1551
1555
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
+
1557
1559
optly . SetFieldOrProperty ( "DecisionService" , DecisionServiceMock . Object ) ;
1558
1560
optly . SetFieldOrProperty ( "EventBuilder" , EventBuilderMock . Object ) ;
1559
1561
@@ -1613,6 +1615,9 @@ public void TestTrackListener(UserAttributes userAttributes, EventTags eventTags
1613
1615
var logEvent = new LogEvent ( "https://logx.optimizely.com/v1/events" , OptimizelyHelper . SingleParameter ,
1614
1616
"POST" , new Dictionary < string , string > { } ) ;
1615
1617
1618
+ var optly = Helper . CreatePrivateOptimizely ( ) ;
1619
+ var optStronglyTyped = optly . GetObject ( ) as Optimizely ;
1620
+
1616
1621
// Mocking objects.
1617
1622
NotificationCallbackMock . Setup ( nc => nc . TestTrackCallback ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ,
1618
1623
It . IsAny < UserAttributes > ( ) , It . IsAny < EventTags > ( ) , It . IsAny < LogEvent > ( ) ) ) ;
@@ -1625,11 +1630,9 @@ public void TestTrackListener(UserAttributes userAttributes, EventTags eventTags
1625
1630
1626
1631
// Adding notification listeners.
1627
1632
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 ) ;
1630
1635
1631
- var optly = Helper . CreatePrivateOptimizely ( ) ;
1632
- optly . SetFieldOrProperty ( "NotificationCenter" , NotificationCenter ) ;
1633
1636
optly . SetFieldOrProperty ( "DecisionService" , DecisionServiceMock . Object ) ;
1634
1637
optly . SetFieldOrProperty ( "EventBuilder" , EventBuilderMock . Object ) ;
1635
1638
0 commit comments