Skip to content

Feat: Adds Decide All, DecideForKeys and track event #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
01bad8f
Added OptimizelyUserContext and basic functionalities
mnoman09 Nov 5, 2020
35c5e76
Added DecisionTests
mnoman09 Nov 6, 2020
f79974c
Added classes of optimizelyDecision in net35 file
mnoman09 Nov 6, 2020
7531f3c
Updated decisionmessage class and added decisionMessage test
mnoman09 Nov 6, 2020
f006b08
Added OptimizelyDecisionTest
mnoman09 Nov 9, 2020
ac0c6a5
Added CreateUserContext in Optimizely
mnoman09 Nov 9, 2020
6c9ac4d
Added UserContext add reason logs
mnoman09 Nov 11, 2020
9e36946
Revert "Added UserContext add reason logs"
mnoman09 Nov 11, 2020
8c78330
Added UserContext add reason logs
mnoman09 Nov 11, 2020
ee465c3
Added TrackEvent, DecideForKeys and DecideAllFunction
mnoman09 Nov 12, 2020
591c770
Replaced list of reasons to array.
mnoman09 Nov 13, 2020
f644b24
Merge branch 'mnoman/user-context' into mnoman/decideapi
mnoman09 Nov 13, 2020
ad77477
Merge remote-tracking branch 'origin/master' into mnoman/user-context
mnoman09 Nov 13, 2020
bab871e
Merge branch 'mnoman/user-context' into mnoman/decideapi
mnoman09 Nov 13, 2020
2c0c3ec
Merge branch 'mnoman/decideapi' into mnoman/decideAllApi
mnoman09 Nov 13, 2020
c3db077
Bug fix
mnoman09 Nov 13, 2020
055bb93
Resolved comments of adding null check before reasons
mnoman09 Nov 13, 2020
5ce1419
removed underscores
mnoman09 Nov 13, 2020
1e388b7
Merge branch 'mnoman/user-context' into mnoman/decideapi
mnoman09 Nov 13, 2020
a7e684b
Merge branch 'mnoman/decideapi' into mnoman/decideAllApi
mnoman09 Nov 13, 2020
a424fef
Added Decide Options unit tests
mnoman09 Nov 16, 2020
7eeb588
Added track event tests and fixes defaultDecideOptions
mnoman09 Nov 16, 2020
8e1750e
Changed UserAttribute to Attributes
mnoman09 Nov 17, 2020
1163cde
Merge branch 'master' into mnoman/user-context
mnoman09 Nov 18, 2020
6330750
Merge branch 'mnoman/user-context' into mnoman/decideapi
mnoman09 Nov 18, 2020
9ec58d3
Merge branch 'mnoman/decideapi' into mnoman/decideAllApi
mnoman09 Nov 18, 2020
980abd0
Added DecisionNotificationType flag
mnoman09 Nov 18, 2020
14769f8
Added check of Key != null in decide
mnoman09 Nov 20, 2020
fafb14c
Added Additional unit tests of optimizelyUserContext
mnoman09 Nov 24, 2020
f9d3939
Merge branch 'mnoman/user-context' into mnoman/decideapi
mnoman09 Nov 24, 2020
671aa29
added notification type flag
mnoman09 Nov 24, 2020
108cc06
Merge branch 'mnoman/decideapi' into mnoman/decideAllApi
mnoman09 Nov 24, 2020
0628e68
Added additional test cases
mnoman09 Nov 25, 2020
a0753a6
Added mutex lock in setting attributes value
mnoman09 Nov 25, 2020
0e9faa1
replaced list from array of decideOptions
mnoman09 Nov 26, 2020
4bd0b3e
Merge branch 'mnoman/user-context' into mnoman/decideapi
mnoman09 Nov 26, 2020
9455e92
Merge branch 'mnoman/decideapi' into mnoman/decideAllApi
mnoman09 Nov 26, 2020
5d0028f
changed decide decideall and decide for keys from public to internal
mnoman09 Nov 26, 2020
320ddc4
Resolved failing scenario
mnoman09 Nov 27, 2020
451e001
Added unit test that byUPS will not call save in userprofile even once
mnoman09 Nov 30, 2020
54e9e74
Removed unnecessary methods from errorDecisionsReasons
mnoman09 Dec 2, 2020
6934f30
Merge branch 'mnoman/user-context' into mnoman/decideapi
mnoman09 Dec 2, 2020
b824b99
Added ignoreUps check first in decision service
mnoman09 Dec 2, 2020
cac22e4
Merge branch 'mnoman/decideapi' into mnoman/decideAllApi
mnoman09 Dec 2, 2020
7eb41c7
Converted a loop to lambda
mnoman09 Dec 2, 2020
eda2743
Nit Fix
mnoman09 Dec 7, 2020
74bd4a5
Merge branch 'mnoman/decideapi' into mnoman/decideAllApi
mnoman09 Dec 7, 2020
f97e302
Changed decide keys to array
mnoman09 Dec 7, 2020
869b655
Added additional test with count of Notfication
mnoman09 Dec 7, 2020
73cd357
Merge branch 'master' into mnoman/decideapi
mnoman09 Dec 8, 2020
fb2ebe4
Merge branch 'mnoman/decideapi' into mnoman/decideAllApi
mnoman09 Dec 8, 2020
fa90e13
replaced copiedOptions = copiedOptions.Concat(options).Concat(Default…
mnoman09 Dec 9, 2020
0f25fb2
Merge remote-tracking branch 'origin/master' into mnoman/decideAllApi
mnoman09 Dec 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OptimizelySDK.Tests/EventTests/EventFactoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void TestCreateImpressionEventNoAttributes()
{ "rule_key", "test_experiment" },
{ "flag_key", "test_experiment" },
{ "variation_key", "control" },
{"enabled", false }
{ "enabled", false }
} }
}
}
Expand Down
20 changes: 12 additions & 8 deletions OptimizelySDK.Tests/OptimizelyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
using System.Globalization;
using System.Threading;
using OptimizelySDK.Tests.Utils;
using OptimizelySDK.OptimizelyDecisions;

namespace OptimizelySDK.Tests
{
Expand Down Expand Up @@ -98,7 +99,7 @@ public void Initialize()
SkipJsonValidation = false,
};

OptimizelyMock = new Mock<Optimizely>(TestData.Datafile, EventDispatcherMock.Object, LoggerMock.Object, ErrorHandlerMock.Object, null, false, null)
OptimizelyMock = new Mock<Optimizely>(TestData.Datafile, EventDispatcherMock.Object, LoggerMock.Object, ErrorHandlerMock.Object, null, false, null, null)
{
CallBase = true
};
Expand Down Expand Up @@ -166,6 +167,8 @@ private class OptimizelyHelper
public bool SkipJsonValidation { get; set; }
public EventProcessor EventProcessor { get; set; }

public OptimizelyDecideOption[] DefaultDecideOptions { get; set; }

public PrivateObject CreatePrivateOptimizely()
{
return new PrivateObject(typeof(Optimizely), ParameterTypes,
Expand All @@ -177,7 +180,8 @@ public PrivateObject CreatePrivateOptimizely()
ErrorHandler,
UserProfileService,
SkipJsonValidation,
EventProcessor
EventProcessor,
DefaultDecideOptions
});
}
}
Expand All @@ -196,7 +200,7 @@ public void TestCreateUserContext()
var optlyUserContext = Optimizely.CreateUserContext(TestUserId, attribute);
Assert.AreEqual(TestUserId, optlyUserContext.UserId);
Assert.AreEqual(Optimizely, optlyUserContext.Optimizely);
Assert.AreEqual(attribute, optlyUserContext.UserAttributes);
Assert.AreEqual(attribute, optlyUserContext.Attributes);
}

[Test]
Expand All @@ -205,7 +209,7 @@ public void TestCreateUserContextWithoutAttributes()
var optlyUserContext = Optimizely.CreateUserContext(TestUserId);
Assert.AreEqual(TestUserId, optlyUserContext.UserId);
Assert.AreEqual(Optimizely, optlyUserContext.Optimizely);
Assert.IsTrue(optlyUserContext.UserAttributes.Count == 0);
Assert.IsTrue(optlyUserContext.Attributes.Count == 0);
}

[Test]
Expand All @@ -228,11 +232,11 @@ public void TestCreateUserContextMultipleAttribute()

Assert.AreEqual("userId1", optlyUserContext1.UserId);
Assert.AreEqual(Optimizely, optlyUserContext1.Optimizely);
Assert.AreEqual(attribute1, optlyUserContext1.UserAttributes);
Assert.AreEqual(attribute1, optlyUserContext1.Attributes);

Assert.AreEqual("userId2", optlyUserContext2.UserId);
Assert.AreEqual(Optimizely, optlyUserContext2.Optimizely);
Assert.AreEqual(attribute2, optlyUserContext2.UserAttributes);
Assert.AreEqual(attribute2, optlyUserContext2.Attributes);
}

[Test]
Expand All @@ -247,7 +251,7 @@ public void TestChangeAttributeDoesNotEffectValues()
var optlyUserContext = Optimizely.CreateUserContext(userId, attribute);
Assert.AreEqual(TestUserId, optlyUserContext.UserId);
Assert.AreEqual(Optimizely, optlyUserContext.Optimizely);
Assert.AreEqual(attribute, optlyUserContext.UserAttributes);
Assert.AreEqual(attribute, optlyUserContext.Attributes);

attribute = new UserAttributes
{
Expand All @@ -258,7 +262,7 @@ public void TestChangeAttributeDoesNotEffectValues()
userId = "InvalidUser";
Assert.AreEqual("testUserId", optlyUserContext.UserId);
Assert.AreEqual(Optimizely, optlyUserContext.Optimizely);
Assert.AreNotEqual(attribute, optlyUserContext.UserAttributes);
Assert.AreNotEqual(attribute, optlyUserContext.Attributes);
}

#endregion
Expand Down
Loading