|
1 | 1 | /*
|
2 |
| - * Copyright 2017-2023, Optimizely |
| 2 | + * Copyright 2017-2024, Optimizely |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -3395,8 +3395,9 @@ public void TestActivateListener(UserAttributes userAttributes)
|
3395 | 3395 | mockUserContext.Setup(ouc => ouc.GetUserId()).Returns(TestUserId);
|
3396 | 3396 |
|
3397 | 3397 | DecisionServiceMock.Setup(ds => ds.GetVariation(experiment,
|
3398 |
| - It.IsAny<OptimizelyUserContext>(), It.IsAny<ProjectConfig>())) |
3399 |
| - .Returns(variation); |
| 3398 | + It.IsAny<OptimizelyUserContext>(), It.IsAny<ProjectConfig>(), |
| 3399 | + It.IsAny<OptimizelyDecideOption[]>(), It.IsAny<bool>())). |
| 3400 | + Returns(variation); |
3400 | 3401 | DecisionServiceMock.Setup(ds => ds.GetVariationForFeature(featureFlag,
|
3401 | 3402 | It.IsAny<OptimizelyUserContext>(), It.IsAny<ProjectConfig>()))
|
3402 | 3403 | .Returns(decision);
|
@@ -3509,9 +3510,10 @@ public void TestTrackListener(UserAttributes userAttributes, EventTags eventTags
|
3509 | 3510 | ErrorHandlerMock.Object, LoggerMock.Object);
|
3510 | 3511 | mockUserContext.Setup(ouc => ouc.GetUserId()).Returns(TestUserId);
|
3511 | 3512 |
|
3512 |
| - DecisionServiceMock |
3513 |
| - .Setup(ds => ds.GetVariation(experiment, It.IsAny<OptimizelyUserContext>(), Config)) |
3514 |
| - .Returns(variation); |
| 3513 | + DecisionServiceMock.Setup(ds => ds.GetVariation(experiment, |
| 3514 | + It.IsAny<OptimizelyUserContext>(), Config, It.IsAny<OptimizelyDecideOption[]>(), |
| 3515 | + It.IsAny<bool>())). |
| 3516 | + Returns(variation); |
3515 | 3517 |
|
3516 | 3518 | // Adding notification listeners.
|
3517 | 3519 | var notificationType = NotificationCenter.NotificationType.Track;
|
@@ -3565,9 +3567,10 @@ public void TestActivateSendsDecisionNotificationWithActualVariationKey()
|
3565 | 3567 | It.IsAny<string>(),
|
3566 | 3568 | It.IsAny<UserAttributes>(), It.IsAny<Dictionary<string, object>>()));
|
3567 | 3569 |
|
3568 |
| - DecisionServiceMock |
3569 |
| - .Setup(ds => ds.GetVariation(experiment, It.IsAny<OptimizelyUserContext>(), Config)) |
3570 |
| - .Returns(variation); |
| 3570 | + DecisionServiceMock.Setup(ds => ds.GetVariation(experiment, |
| 3571 | + It.IsAny<OptimizelyUserContext>(), Config, It.IsAny<OptimizelyDecideOption[]>(), |
| 3572 | + It.IsAny<bool>())). |
| 3573 | + Returns(variation); |
3571 | 3574 |
|
3572 | 3575 | var optly = Helper.CreatePrivateOptimizely();
|
3573 | 3576 | optly.SetFieldOrProperty("ProjectConfigManager", ConfigManager);
|
@@ -3622,9 +3625,10 @@ public void
|
3622 | 3625 | It.IsAny<string>(),
|
3623 | 3626 | It.IsAny<UserAttributes>(), It.IsAny<Dictionary<string, object>>()));
|
3624 | 3627 |
|
3625 |
| - DecisionServiceMock |
3626 |
| - .Setup(ds => ds.GetVariation(experiment, It.IsAny<OptimizelyUserContext>(), Config)) |
3627 |
| - .Returns(variation); |
| 3628 | + DecisionServiceMock.Setup(ds => ds.GetVariation(experiment, |
| 3629 | + It.IsAny<OptimizelyUserContext>(), Config, It.IsAny<OptimizelyDecideOption[]>(), |
| 3630 | + It.IsAny<bool>())). |
| 3631 | + Returns(variation); |
3628 | 3632 |
|
3629 | 3633 | var optly = Helper.CreatePrivateOptimizely();
|
3630 | 3634 | optly.SetFieldOrProperty("ProjectConfigManager", ConfigManager);
|
@@ -3666,8 +3670,9 @@ public void TestActivateSendsDecisionNotificationWithNullVariationKey()
|
3666 | 3670 |
|
3667 | 3671 | DecisionServiceMock.Setup(ds => ds.GetVariation(experiment,
|
3668 | 3672 | It.IsAny<OptimizelyUserContext>(),
|
3669 |
| - It.IsAny<ProjectConfig>(), null)) |
3670 |
| - .Returns(Result<Variation>.NullResult(null)); |
| 3673 | + It.IsAny<ProjectConfig>(), It.IsAny<OptimizelyDecideOption[]>(), |
| 3674 | + It.IsAny<bool>())). |
| 3675 | + Returns(Result<Variation>.NullResult(null)); |
3671 | 3676 |
|
3672 | 3677 | optStronglyTyped.NotificationCenter.AddNotification(
|
3673 | 3678 | NotificationCenter.NotificationType.Decision,
|
@@ -3727,9 +3732,10 @@ public void TestGetVariationSendsDecisionNotificationWithActualVariationKey()
|
3727 | 3732 | ErrorHandlerMock.Object, LoggerMock.Object);
|
3728 | 3733 | mockUserContext.Setup(ouc => ouc.GetUserId()).Returns(TestUserId);
|
3729 | 3734 |
|
3730 |
| - DecisionServiceMock |
3731 |
| - .Setup(ds => ds.GetVariation(experiment, It.IsAny<OptimizelyUserContext>(), Config)) |
3732 |
| - .Returns(variation); |
| 3735 | + DecisionServiceMock.Setup(ds => ds.GetVariation(experiment, |
| 3736 | + It.IsAny<OptimizelyUserContext>(), Config, It.IsAny<OptimizelyDecideOption[]>(), |
| 3737 | + It.IsAny<bool>())). |
| 3738 | + Returns(variation); |
3733 | 3739 |
|
3734 | 3740 | optStronglyTyped.NotificationCenter.AddNotification(
|
3735 | 3741 | NotificationCenter.NotificationType.Decision,
|
@@ -3788,9 +3794,10 @@ public void
|
3788 | 3794 | ErrorHandlerMock.Object, LoggerMock.Object);
|
3789 | 3795 | mockUserContext.Setup(ouc => ouc.GetUserId()).Returns(TestUserId);
|
3790 | 3796 |
|
3791 |
| - DecisionServiceMock |
3792 |
| - .Setup(ds => ds.GetVariation(experiment, It.IsAny<OptimizelyUserContext>(), Config)) |
3793 |
| - .Returns(variation); |
| 3797 | + DecisionServiceMock. |
| 3798 | + Setup(ds => ds.GetVariation(experiment, It.IsAny<OptimizelyUserContext>(), Config |
| 3799 | + , It.IsAny<OptimizelyDecideOption[]>(), It.IsAny<bool>())). |
| 3800 | + Returns(variation); |
3794 | 3801 |
|
3795 | 3802 | optStronglyTyped.NotificationCenter.AddNotification(
|
3796 | 3803 | NotificationCenter.NotificationType.Decision,
|
@@ -3828,8 +3835,9 @@ public void TestGetVariationSendsDecisionNotificationWithNullVariationKey()
|
3828 | 3835 | It.IsAny<UserAttributes>(), It.IsAny<Dictionary<string, object>>()));
|
3829 | 3836 |
|
3830 | 3837 | DecisionServiceMock.Setup(ds => ds.GetVariation(It.IsAny<Experiment>(),
|
3831 |
| - It.IsAny<OptimizelyUserContext>(), It.IsAny<ProjectConfig>())) |
3832 |
| - .Returns(Result<Variation>.NullResult(null)); |
| 3838 | + It.IsAny<OptimizelyUserContext>(), It.IsAny<ProjectConfig>() |
| 3839 | + , It.IsAny<OptimizelyDecideOption[]>(), It.IsAny<bool>())). |
| 3840 | + Returns(Result<Variation>.NullResult(null)); |
3833 | 3841 | //DecisionServiceMock.Setup(ds => ds.GetVariation(experiment, TestUserId, Config, null)).Returns(Result<Variation>.NullResult(null));
|
3834 | 3842 |
|
3835 | 3843 | optStronglyTyped.NotificationCenter.AddNotification(
|
@@ -3875,8 +3883,9 @@ public void
|
3875 | 3883 | It.IsAny<UserAttributes>(), It.IsAny<Dictionary<string, object>>()));
|
3876 | 3884 |
|
3877 | 3885 | DecisionServiceMock.Setup(ds => ds.GetVariation(experiment,
|
3878 |
| - It.IsAny<OptimizelyUserContext>(), ConfigManager.GetConfig(), null)) |
3879 |
| - .Returns(variation); |
| 3886 | + It.IsAny<OptimizelyUserContext>(), ConfigManager.GetConfig() |
| 3887 | + , It.IsAny<OptimizelyDecideOption[]>(), It.IsAny<bool>())). |
| 3888 | + Returns(variation); |
3880 | 3889 |
|
3881 | 3890 | var optly = Helper.CreatePrivateOptimizely();
|
3882 | 3891 | var optStronglyTyped = optly.GetObject() as Optimizely;
|
@@ -3936,8 +3945,9 @@ public void
|
3936 | 3945 | It.IsAny<UserAttributes>(), It.IsAny<Dictionary<string, object>>()));
|
3937 | 3946 |
|
3938 | 3947 | DecisionServiceMock.Setup(ds =>
|
3939 |
| - ds.GetVariation(experiment, It.IsAny<OptimizelyUserContext>(), Config, null)) |
3940 |
| - .Returns(variation); |
| 3948 | + ds.GetVariation(experiment, It.IsAny<OptimizelyUserContext>(), Config |
| 3949 | + , It.IsAny<OptimizelyDecideOption[]>(), It.IsAny<bool>())). |
| 3950 | + Returns(variation); |
3941 | 3951 |
|
3942 | 3952 | var optly = Helper.CreatePrivateOptimizely();
|
3943 | 3953 | var optStronglyTyped = optly.GetObject() as Optimizely;
|
@@ -5322,7 +5332,8 @@ public void TestGetAllFeatureVariablesReturnsNullScenarios()
|
5322 | 5332 |
|
5323 | 5333 | LoggerMock.Verify(
|
5324 | 5334 | log => log.Log(LogLevel.ERROR,
|
5325 |
| - "Optimizely instance is not valid, failing getAllFeatureVariableValues call. type"), |
| 5335 | + "Optimizely instance is not valid, failing getAllFeatureVariableValues call. type") |
| 5336 | + , |
5326 | 5337 | Times.Once);
|
5327 | 5338 | }
|
5328 | 5339 |
|
|
0 commit comments