Skip to content

Commit

Permalink
Adjust model and tests to config v6 schema changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adams85 committed Oct 25, 2023
1 parent dedac02 commit 009cf0f
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 54 deletions.
8 changes: 4 additions & 4 deletions src/ConfigCat.Client.Tests/ModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void SettingValue_ToString(object? value, string expectedResult)
}

[DataTestMethod]
[DataRow(BasicSampleSdkKey, null, "stringIsNotInDogDefaultCat", 0, 0, new[] { "User.Email IS NOT ONE OF [<2 hashed values>]" })]
[DataRow(BasicSampleSdkKey, null, "stringIsNotInDogDefaultCat", 0, 0, new[] { "User.Email IS NOT ONE OF ['[email protected]', '[email protected]']" })]
[DataRow(SegmentsV6SampleSdkKey, null, "countrySegment", 0, 0, new[] { "User IS IN SEGMENT 'United'" })]
[DataRow(FlagDependencyV6SampleSdkKey, null, "boolDependsOnBool", 0, 0, new[] { "Flag 'mainBoolFlag' EQUALS 'True'" })]
public void Condition_ToString(string? sdkKey, string baseUrlOrFileName, string settingKey, int targetingRuleIndex, int conditionIndex, string[] expectedResultLines)
Expand Down Expand Up @@ -71,7 +71,7 @@ public void PercentageOption_ToString(string? sdkKey, string baseUrlOrFileName,
[DataTestMethod]
[DataRow(BasicSampleSdkKey, null, "stringIsNotInDogDefaultCat", 0, new[]
{
"IF User.Email IS NOT ONE OF [<2 hashed values>]",
"IF User.Email IS NOT ONE OF ['[email protected]', '[email protected]']",
"THEN 'Dog'",
})]
[DataRow(ComparatorsV6SampleSdkKey, null, "missingPercentageAttribute", 0, new[]
Expand Down Expand Up @@ -102,7 +102,7 @@ public void TargetingRule_ToString(string? sdkKey, string baseUrlOrFileName, str
[DataRow(null, "test_json_complex", "doubleSetting", new[] { "To all users: '3.14'" })]
[DataRow(BasicSampleSdkKey, null, "stringIsNotInDogDefaultCat", new[]
{
"IF User.Email IS NOT ONE OF [<2 hashed values>]",
"IF User.Email IS NOT ONE OF ['[email protected]', '[email protected]']",
"THEN 'Dog'",
"To all others: 'Cat'",
})]
Expand All @@ -122,7 +122,7 @@ public void TargetingRule_ToString(string? sdkKey, string baseUrlOrFileName, str
})]
[DataRow(BasicSampleSdkKey, null, "string25Cat25Dog25Falcon25HorseAdvancedRules", new[]
{
"IF User.Country IS ONE OF [<2 hashed values>]",
"IF User.Country IS ONE OF ['Hungary', 'United Kingdom']",
"THEN 'Dolphin'",
"ELSE IF User.Custom1 CONTAINS ANY OF ['admi']",
"THEN 'Lion'",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF [<2 hashed values>]) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF ['[email protected]', '[email protected]']) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'stringIsInDogDefaultCat' for User '{"Identifier":"12345","Custom1":"admin"}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email IS ONE OF [<2 hashed values>] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing
- IF User.Email IS ONE OF ['[email protected]', '[email protected]'] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
- IF User.Custom1 IS ONE OF [<1 hashed value>] THEN 'Dog' => MATCH, applying rule
- IF User.Custom1 IS ONE OF ['admin'] THEN 'Dog' => MATCH, applying rule
Returning 'Dog'.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF [<2 hashed values>]) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
WARNING [3003] Cannot evaluate condition (User.Custom1 IS ONE OF [<1 hashed value>]) for setting 'stringIsInDogDefaultCat' (the User.Custom1 attribute is missing). You should set the User.Custom1 attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF ['[email protected]', '[email protected]']) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
WARNING [3003] Cannot evaluate condition (User.Custom1 IS ONE OF ['admin']) for setting 'stringIsInDogDefaultCat' (the User.Custom1 attribute is missing). You should set the User.Custom1 attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'stringIsInDogDefaultCat' for User '{"Identifier":"12345"}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email IS ONE OF [<2 hashed values>] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing
- IF User.Email IS ONE OF ['[email protected]', '[email protected]'] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
- IF User.Custom1 IS ONE OF [<1 hashed value>] THEN 'Dog' => cannot evaluate, the User.Custom1 attribute is missing
- IF User.Custom1 IS ONE OF ['admin'] THEN 'Dog' => cannot evaluate, the User.Custom1 attribute is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
WARNING [3001] Cannot evaluate targeting rules and % options for setting 'stringIsInDogDefaultCat' (User Object is missing). You should pass a User Object to the evaluation methods like `GetValue()`/`GetValueAsync()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'stringIsInDogDefaultCat'
Evaluating targeting rules and applying the first match if any:
- IF User.Email IS ONE OF [<2 hashed values>] THEN 'Dog' => cannot evaluate, User Object is missing
- IF User.Email IS ONE OF ['[email protected]', '[email protected]'] THEN 'Dog' => cannot evaluate, User Object is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
- IF User.Custom1 IS ONE OF [<1 hashed value>] THEN 'Dog' => cannot evaluate, User Object is missing
- IF User.Custom1 IS ONE OF ['admin'] THEN 'Dog' => cannot evaluate, User Object is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF [<2 hashed values>]) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
WARNING [3003] Cannot evaluate condition (User.Email IS ONE OF ['[email protected]', '[email protected]']) for setting 'stringIsInDogDefaultCat' (the User.Email attribute is missing). You should set the User.Email attribute in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'stringIsInDogDefaultCat' for User '{"Identifier":"12345","Custom1":"user"}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email IS ONE OF [<2 hashed values>] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing
- IF User.Email IS ONE OF ['[email protected]', '[email protected]'] THEN 'Dog' => cannot evaluate, the User.Email attribute is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
- IF User.Custom1 IS ONE OF [<1 hashed value>] THEN 'Dog' => no match
- IF User.Custom1 IS ONE OF ['admin'] THEN 'Dog' => no match
Returning 'Cat'.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
"t": 1,
"v": { "s": "value1" },
"r": [
{"c": [{"d": {"f": "key2", "c": 0, "v": {"s": "fourth"}}}], "s": {"v": {"s": "first"}}},
{"c": [{"d": {"f": "key3", "c": 0, "v": {"s": "value3"}}}], "s": {"v": {"s": "second"}}}
{"c": [{"p": {"f": "key2", "c": 0, "v": {"s": "fourth"}}}], "s": {"v": {"s": "first"}}},
{"c": [{"p": {"f": "key3", "c": 0, "v": {"s": "value3"}}}], "s": {"v": {"s": "second"}}}
]
},
"key2": {
"t": 1,
"v": { "s": "value2" },
"r": [
{"c": [{"d": {"f": "key1", "c": 0, "v": {"s": "value1"}}}], "s": {"v": {"s": "third"}}},
{"c": [{"d": {"f": "key3", "c": 0, "v": {"s": "value3"}}}], "s": {"v": {"s": "fourth"}}}
{"c": [{"p": {"f": "key1", "c": 0, "v": {"s": "value1"}}}], "s": {"v": {"s": "third"}}},
{"c": [{"p": {"f": "key3", "c": 0, "v": {"s": "value3"}}}], "s": {"v": {"s": "fourth"}}}
]
},
"key3": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Identifier",
"c": 2,
"l": [
Expand All @@ -32,7 +32,7 @@
}
},
{
"t": {
"u": {
"a": "Identifier",
"c": 2,
"l": [
Expand All @@ -51,7 +51,7 @@
}
},
{
"t": {
"u": {
"a": "Identifier",
"c": 2,
"l": [
Expand Down
28 changes: 14 additions & 14 deletions src/ConfigCat.Client.Tests/data/sample_v5.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 16,
"l": [
Expand All @@ -34,7 +34,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Custom1",
"c": 16,
"l": [
Expand All @@ -60,7 +60,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 17,
"l": [
Expand All @@ -87,7 +87,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 2,
"l": [
Expand All @@ -113,7 +113,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 3,
"l": [
Expand Down Expand Up @@ -203,7 +203,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Country",
"c": 16,
"l": [
Expand All @@ -222,7 +222,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Custom1",
"c": 2,
"l": [
Expand All @@ -240,7 +240,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 2,
"l": [
Expand Down Expand Up @@ -304,7 +304,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 16,
"l": [
Expand All @@ -323,7 +323,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Country",
"c": 2,
"l": [
Expand Down Expand Up @@ -363,7 +363,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 2,
"l": [
Expand Down Expand Up @@ -427,7 +427,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 2,
"l": [
Expand Down Expand Up @@ -479,7 +479,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Country",
"c": 16,
"l": [
Expand All @@ -498,7 +498,7 @@
{
"c": [
{
"t": {
"u": {
"a": "SubscriptionType",
"c": 16,
"l": [
Expand Down
14 changes: 7 additions & 7 deletions src/ConfigCat.Client.Tests/data/sample_variationid_v5.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 2,
"l": [
Expand Down Expand Up @@ -53,7 +53,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 2,
"l": [
Expand All @@ -72,7 +72,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 2,
"l": [
Expand Down Expand Up @@ -116,7 +116,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 2,
"l": [
Expand Down Expand Up @@ -160,7 +160,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 2,
"l": [
Expand All @@ -179,7 +179,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 16,
"l": [
Expand All @@ -198,7 +198,7 @@
{
"c": [
{
"t": {
"u": {
"a": "Email",
"c": 16,
"l": [
Expand Down
10 changes: 5 additions & 5 deletions src/ConfigCat.Client.Tests/data/test_circulardependency_v6.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{
"c": [
{
"d": {
"p": {
"f": "key1",
"c": 0,
"v": { "s": "key1-prereq1" }
Expand All @@ -23,7 +23,7 @@
{
"c": [
{
"d": {
"p": {
"f": "key2",
"c": 0,
"v": { "s": "key1-prereq2" }
Expand All @@ -35,7 +35,7 @@
{
"c": [
{
"d": {
"p": {
"f": "key3",
"c": 0,
"v": { "s": "key1-prereq3" }
Expand All @@ -53,7 +53,7 @@
{
"c": [
{
"d": {
"p": {
"f": "key1",
"c": 0,
"v": { "s": "key2-prereq1" }
Expand All @@ -71,7 +71,7 @@
{
"c": [
{
"d": {
"p": {
"f": "key3",
"c": 0,
"v": { "s": "key3-prereq1" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{
"c": [
{
"d": {
"p": {
"f": "mainIntFlag",
"c": 0,
"v": {
Expand Down
8 changes: 4 additions & 4 deletions src/ConfigCatClient/Models/ConditionContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ internal struct ConditionContainer : IConditionProvider
private object? condition;

#if USE_NEWTONSOFT_JSON
[JsonProperty(PropertyName = "t")]
[JsonProperty(PropertyName = "u")]
#else
[JsonPropertyName("t")]
[JsonPropertyName("u")]
#endif
public UserCondition? UserCondition
{
Expand All @@ -36,9 +36,9 @@ public SegmentCondition? SegmentCondition
}

#if USE_NEWTONSOFT_JSON
[JsonProperty(PropertyName = "d")]
[JsonProperty(PropertyName = "p")]
#else
[JsonPropertyName("d")]
[JsonPropertyName("p")]
#endif
public PrerequisiteFlagCondition? PrerequisiteFlagCondition
{
Expand Down

0 comments on commit 009cf0f

Please sign in to comment.