-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature-variationid, Case Sensitive support, userID can be null (#13)
* implement 'variation id' feature * add unit and integration test for variationid * RELEASE v5.3 Co-authored-by: andrew-cat <[email protected]>
- Loading branch information
Showing
19 changed files
with
817 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,5 +127,88 @@ private static async Task GetValueAsyncAndAssert(IConfigCatClient client, string | |
Assert.AreEqual(expectedValue, actual); | ||
Assert.AreNotEqual(defaultValue, actual); | ||
} | ||
|
||
[TestMethod] | ||
public void GetVariationId() | ||
{ | ||
IConfigCatClient manualPollClient = ConfigCatClientBuilder | ||
.Initialize(SDKKEY) | ||
.WithLogger(consoleLogger) | ||
.WithManualPoll() | ||
.Create(); | ||
|
||
manualPollClient.ForceRefresh(); | ||
var actual = manualPollClient.GetVariationId("stringDefaultCat", "default"); | ||
|
||
Assert.AreEqual("7a0be518", actual); | ||
} | ||
|
||
[TestMethod] | ||
public async Task GetVariationIdAsync() | ||
{ | ||
IConfigCatClient manualPollClient = ConfigCatClientBuilder | ||
.Initialize(SDKKEY) | ||
.WithLogger(consoleLogger) | ||
.WithManualPoll() | ||
.Create(); | ||
|
||
await manualPollClient.ForceRefreshAsync(); | ||
|
||
var actual = await manualPollClient.GetVariationIdAsync("stringDefaultCat", "default"); | ||
|
||
Assert.AreEqual("7a0be518", actual); | ||
} | ||
|
||
[TestMethod] | ||
public void GetAllVariationId() | ||
{ | ||
// Arrange | ||
|
||
const string expectedJsonString = "[\"7a0be518\",\"83372510\",\"2459598d\",\"ce564c3a\",\"44ab483a\",\"d227b334\",\"93f5a1c0\",\"bb66b1f3\",\"09513143\",\"489a16d2\",\"607147d5\",\"11634414\",\"faadbf54\",\"5af8acc7\",\"183ee713\",\"baff2362\"]"; | ||
|
||
var expectedValue = Newtonsoft.Json.JsonConvert.DeserializeObject<string[]>(expectedJsonString); | ||
|
||
IConfigCatClient manualPollClient = ConfigCatClientBuilder | ||
.Initialize(SDKKEY) | ||
.WithLogger(consoleLogger) | ||
.WithManualPoll() | ||
.Create(); | ||
|
||
manualPollClient.ForceRefresh(); | ||
|
||
// Act | ||
|
||
var actual = manualPollClient.GetAllVariationId(new User("[email protected]")); | ||
|
||
// Assert | ||
Assert.AreEqual(16, expectedValue.Length); | ||
CollectionAssert.AreEquivalent(expectedValue, actual.ToArray()); | ||
} | ||
|
||
[TestMethod] | ||
public async Task GetAllVariationIdAsync() | ||
{ | ||
// Arrange | ||
|
||
const string expectedJsonString = "[\"7a0be518\",\"83372510\",\"2459598d\",\"ce564c3a\",\"44ab483a\",\"d227b334\",\"93f5a1c0\",\"bb66b1f3\",\"09513143\",\"489a16d2\",\"607147d5\",\"11634414\",\"faadbf54\",\"5af8acc7\",\"183ee713\",\"baff2362\"]"; | ||
|
||
var expectedValue = Newtonsoft.Json.JsonConvert.DeserializeObject<string[]>(expectedJsonString); | ||
|
||
IConfigCatClient manualPollClient = ConfigCatClientBuilder | ||
.Initialize(SDKKEY) | ||
.WithLogger(consoleLogger) | ||
.WithManualPoll() | ||
.Create(); | ||
|
||
await manualPollClient.ForceRefreshAsync(); | ||
|
||
// Act | ||
|
||
var actual = await manualPollClient.GetAllVariationIdAsync(new User("[email protected]")); | ||
|
||
// Assert | ||
Assert.AreEqual(16, expectedValue.Length); | ||
CollectionAssert.AreEquivalent(expectedValue, actual.ToArray()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.