-
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.
- Loading branch information
1 parent
ed8e247
commit 2d7022e
Showing
44 changed files
with
1,466 additions
and
397 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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Collections.Generic; | ||
|
||
namespace ConfigCat.Client.Tests | ||
{ | ||
[TestClass] | ||
public class BasicConfigEvaluatorTests : ConfigEvaluatorTestsBase | ||
{ | ||
protected override string SampleJsonFileName => "sample_v3.json"; | ||
|
||
protected override string MatrixResultFileName => "testmatrix.csv"; | ||
|
||
[TestMethod] | ||
public void GetValue_WithSimpleKey_ShouldReturnCat() | ||
{ | ||
string actual = configEvaluator.Evaluate(config, "stringDefaultCat", string.Empty); | ||
|
||
Assert.AreNotEqual(string.Empty, actual); | ||
Assert.AreEqual("Cat", actual); | ||
} | ||
|
||
[TestMethod] | ||
public void GetValue_WithNonExistingKey_ShouldReturnDefaultValue() | ||
{ | ||
string actual = configEvaluator.Evaluate(config, "NotExistsKey", "NotExistsValue"); | ||
|
||
Assert.AreEqual("NotExistsValue", actual); | ||
} | ||
|
||
[TestMethod] | ||
public void GetValue_WithEmptyProjectConfig_ShouldReturnDefaultValue() | ||
{ | ||
string actual = configEvaluator.Evaluate(ProjectConfig.Empty, "stringDefaultCat", "Default"); | ||
|
||
Assert.AreEqual("Default", actual); | ||
} | ||
|
||
[TestMethod] | ||
public void GetValue_WithUser_ShouldReturnEvaluatedValue() | ||
{ | ||
double actual = configEvaluator.Evaluate(config, "doubleDefaultPi", double.NaN, new User("[email protected]") | ||
{ | ||
Email = "[email protected]", | ||
Country = "United Kingdom", | ||
Custom = new Dictionary<string, string> { { "Custom1", "admin" } } | ||
}); | ||
|
||
Assert.AreEqual(3.1415, actual); | ||
} | ||
} | ||
} |
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.