diff --git a/src/ConfigCat.Client.Tests/ConfigCat.Client.Tests.csproj b/src/ConfigCat.Client.Tests/ConfigCat.Client.Tests.csproj
index d3dd6512..3a688b8a 100644
--- a/src/ConfigCat.Client.Tests/ConfigCat.Client.Tests.csproj
+++ b/src/ConfigCat.Client.Tests/ConfigCat.Client.Tests.csproj
@@ -31,6 +31,7 @@
+
diff --git a/src/ConfigCat.Client.Tests/ConfigCatClientTests.cs b/src/ConfigCat.Client.Tests/ConfigCatClientTests.cs
index 1b16629e..ed009b26 100644
--- a/src/ConfigCat.Client.Tests/ConfigCatClientTests.cs
+++ b/src/ConfigCat.Client.Tests/ConfigCatClientTests.cs
@@ -57,6 +57,44 @@ public void CreateAnInstance_WhenSdkKeyIsNull_ShouldThrowArgumentNullException()
using var _ = ConfigCatClient.Get(sdkKey!);
}
+ [DataRow("sdk-key-90123456789012", false, false)]
+ [DataRow("sdk-key-9012345678901/1234567890123456789012", false, false)]
+ [DataRow("sdk-key-90123456789012/123456789012345678901", false, false)]
+ [DataRow("sdk-key-90123456789012/12345678901234567890123", false, false)]
+ [DataRow("sdk-key-901234567890123/1234567890123456789012", false, false)]
+ [DataRow("sdk-key-90123456789012/1234567890123456789012", false, true)]
+ [DataRow("configcat-sdk-1/sdk-key-90123456789012", false, false)]
+ [DataRow("configcat-sdk-1/sdk-key-9012345678901/1234567890123456789012", false, false)]
+ [DataRow("configcat-sdk-1/sdk-key-90123456789012/123456789012345678901", false, false)]
+ [DataRow("configcat-sdk-1/sdk-key-90123456789012/12345678901234567890123", false, false)]
+ [DataRow("configcat-sdk-1/sdk-key-901234567890123/1234567890123456789012", false, false)]
+ [DataRow("configcat-sdk-1/sdk-key-90123456789012/1234567890123456789012", false, true)]
+ [DataRow("configcat-sdk-2/sdk-key-90123456789012/1234567890123456789012", false, false)]
+ [DataRow("configcat-proxy/", false, false)]
+ [DataRow("configcat-proxy/", true, false)]
+ [DataRow("configcat-proxy/sdk-key-90123456789012", false, false)]
+ [DataRow("configcat-proxy/sdk-key-90123456789012", true, true)]
+ [DataTestMethod]
+ [DoNotParallelize]
+ public void SdkKeyFormat_ShouldBeValidated(string sdkKey, bool customBaseUrl, bool isValid)
+ {
+ Action? configureOptions = customBaseUrl
+ ? o => o.BaseUrl = new Uri("https://my-configcat-proxy")
+ : null;
+
+ if (isValid)
+ {
+ using var _ = ConfigCatClient.Get(sdkKey, configureOptions);
+ }
+ else
+ {
+ Assert.ThrowsException(() =>
+ {
+ using var _ = ConfigCatClient.Get(sdkKey, configureOptions);
+ });
+ }
+ }
+
[ExpectedException(typeof(ArgumentOutOfRangeException))]
[TestMethod]
[DoNotParallelize]
diff --git a/src/ConfigCat.Client.Tests/ConfigV6EvaluationTests.cs b/src/ConfigCat.Client.Tests/ConfigV6EvaluationTests.cs
index a4974c5f..12f3999f 100644
--- a/src/ConfigCat.Client.Tests/ConfigV6EvaluationTests.cs
+++ b/src/ConfigCat.Client.Tests/ConfigV6EvaluationTests.cs
@@ -1,6 +1,11 @@
+using System;
using System.Collections.Generic;
+using System.Linq;
+using System.Text.RegularExpressions;
using ConfigCat.Client.Evaluation;
+using ConfigCat.Client.Tests.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
namespace ConfigCat.Client.Tests;
@@ -79,4 +84,58 @@ public void SegmentTests(string jsonFileName, string settingKey, string expected
MatrixTestRunner.Default.RunTest(this.configEvaluator, this.logger, settingKey, expectedReturnValue,
userId, userEmail, userCountry, userCustomAttributeName, userCustomAttributeValue);
}
+
+ [TestMethod]
+ public void CircularDependencyTest()
+ {
+ var configJson = ConfigHelper.GetSampleJson("sample_circulardependency_v6.json");
+ var config = configJson.Deserialize()!;
+
+ var logEvents = new List<(LogLevel Level, LogEventId EventId, FormattableLogMessage Message, Exception? Exception)>();
+
+ var loggerMock = new Mock();
+ loggerMock.SetupGet(logger => logger.LogLevel).Returns(LogLevel.Info);
+ loggerMock.Setup(logger => logger.Log(It.IsAny(), It.IsAny(), ref It.Ref.IsAny, It.IsAny()))
+ .Callback(delegate (LogLevel level, LogEventId eventId, ref FormattableLogMessage msg, Exception ex) { logEvents.Add((level, eventId, msg, ex)); });
+
+ var loggerWrapper = loggerMock.Object.AsWrapper();
+
+ var evaluator = new RolloutEvaluator(loggerWrapper);
+
+ const string key = "key1";
+ var evaluationDetails = evaluator.Evaluate