This commit is contained in:
Janus C. H. Knudsen 2025-03-07 00:17:08 +01:00
parent 0010a32248
commit ddb6abc14e
14 changed files with 754 additions and 718 deletions

View file

@ -1,8 +1,7 @@
using Newtonsoft.Json.Linq;
using PlanTempus.Core.Configurations.Common;
using PlanTempus.Tests;
namespace PlanTempus.Tests.ConfigurationTests;
namespace PlanTempus.X.TDD.ConfigurationTests;
[TestClass]
public class ConfigurationTests : TestFixture
@ -17,31 +16,31 @@ public class ConfigurationTests : TestFixture
public void ConfigurationSettingsTest()
{
var pairs = new List<KeyValuePair<string, JToken>>
{
new("Debug", true),
// Database konfiguration
new("Database:ConnectionString", "Server=db.example.com;Port=5432"),
new("Database:Timeout", 30),
new("Database:UseSSL", true),
{
new("Debug", true),
// Database konfiguration
new("Database:ConnectionString", "Server=db.example.com;Port=5432"),
new("Database:Timeout", 30),
new("Database:UseSSL", true),
// Logging konfiguration med JObject
new("Logging:FileOptions", JObject.Parse(@"{
// Logging konfiguration med JObject
new("Logging:FileOptions", JObject.Parse(@"{
'Path': '/var/logs/app.log',
'MaxSizeMB': 100,
'RetentionDays': 7
}")),
// Feature flags med kompleks konfiguration
new("Features:Experimental", JObject.Parse(@"{
// Feature flags med kompleks konfiguration
new("Features:Experimental", JObject.Parse(@"{
'Enabled': true,
'RolloutPercentage': 25,
'AllowedUserGroups': ['beta']
}")),
// API endpoints med array
new("API:Endpoints", "/api/users"),
new("API:Endpoints", "/api/products")
};
// API endpoints med array
new("API:Endpoints", "/api/users"),
new("API:Endpoints", "/api/products")
};
var result = KeyValueToJson.Convert(pairs);