wip
This commit is contained in:
parent
0f1a345216
commit
e73f428c49
6 changed files with 96 additions and 144 deletions
|
|
@ -9,7 +9,11 @@ namespace Tests.ConfigurationTests
|
|||
[TestClass]
|
||||
public class JsonConfigurationProviderTests : TestFixture
|
||||
{
|
||||
public JsonConfigurationProviderTests() : base("ConfigurationTests") { }
|
||||
const string _testFolder = "ConfigurationTests/";
|
||||
|
||||
public JsonConfigurationProviderTests() : base(_testFolder) { }
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void GetSection_ShouldReturnCorrectFeatureSection()
|
||||
{
|
||||
|
|
@ -21,7 +25,7 @@ namespace Tests.ConfigurationTests
|
|||
}") as JToken;
|
||||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.dev.json")
|
||||
.AddJsonFile($"{_testFolder}appconfiguration.dev.json")
|
||||
.Build();
|
||||
|
||||
// Act
|
||||
|
|
@ -44,8 +48,8 @@ namespace Tests.ConfigurationTests
|
|||
};
|
||||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.dev.json")
|
||||
.Build();
|
||||
.AddJsonFile($"{_testFolder}appconfiguration.dev.json")
|
||||
.Build();
|
||||
|
||||
// Act
|
||||
var actualFeature = builder.GetSection("Feature").ToObject<Feature>();
|
||||
|
|
@ -64,8 +68,8 @@ namespace Tests.ConfigurationTests
|
|||
var expectedFeature = "123";
|
||||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.dev.json")
|
||||
.Build();
|
||||
.AddJsonFile($"{_testFolder}appconfiguration.dev.json")
|
||||
.Build();
|
||||
|
||||
// Act
|
||||
var actualFeature = builder.GetSection("AnotherSetting").Get<string>("Thresholds:High");
|
||||
|
|
@ -83,8 +87,8 @@ namespace Tests.ConfigurationTests
|
|||
var expected = "SHA256";
|
||||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.dev.json")
|
||||
.Build();
|
||||
.AddJsonFile($"{_testFolder}appconfiguration.dev.json")
|
||||
.Build();
|
||||
|
||||
// Act
|
||||
var actual = builder["Authentication"];
|
||||
|
|
@ -99,8 +103,8 @@ namespace Tests.ConfigurationTests
|
|||
var expectedFeature = 22;
|
||||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.dev.json")
|
||||
.Build();
|
||||
.AddJsonFile($"{_testFolder}appconfiguration.dev.json")
|
||||
.Build();
|
||||
|
||||
// Act
|
||||
var actualFeature = builder.GetSection("AnotherSetting:Temperature").Get<int>("Indoor:Max:Limit");
|
||||
|
|
@ -115,8 +119,8 @@ namespace Tests.ConfigurationTests
|
|||
var expectedFeature = true;
|
||||
|
||||
var configRoot = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.dev.json")
|
||||
.AddSmartConfig()
|
||||
.AddJsonFile($"{_testFolder}appconfiguration.dev.json")
|
||||
.AddSmartConfig()
|
||||
.Build();
|
||||
|
||||
// Act
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue