diff --git a/Flagsmith.Client.Test/Fixtures.cs b/Flagsmith.Client.Test/Fixtures.cs index 6cd17af..4af0160 100644 --- a/Flagsmith.Client.Test/Fixtures.cs +++ b/Flagsmith.Client.Test/Fixtures.cs @@ -8,7 +8,7 @@ namespace Flagsmith.FlagsmithClientTest { internal class Fixtures { - public static string ApiKey => "ser.test_key"; + public static string ApiKey => "test_key"; public static string ApiUrl => "http://test_url/"; public static AnalyticsProcessorTest GetAnalyticalProcessorTest() => new(new HttpClient(), ApiKey, ApiUrl); public static JObject JsonObject = JObject.Parse(@"{ diff --git a/Flagsmith.Client.Test/FlagsmithTest.cs b/Flagsmith.Client.Test/FlagsmithTest.cs index 7674ce2..ea10cdf 100644 --- a/Flagsmith.Client.Test/FlagsmithTest.cs +++ b/Flagsmith.Client.Test/FlagsmithTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -523,24 +523,6 @@ public void TestCannotCreateFlagsmithClientInRemoteEvaluationWithoutAPIKey() Assert.Equal("ValueError: environmentKey is required", exception.Message); } - [Fact] - public void TestCannotCreateFlagsmithClientInLocalEvaluationWithoutServerAPIKey() - { - // When - Action createFlagsmith = () => new FlagsmithClient( - environmentKey: "foobar", - enableClientSideEvaluation: true - ); - - // Then - var exception = Assert.Throws(() => createFlagsmith()); - Assert.Equal - ( - "ValueError: In order to use local evaluation, please generate a server key in the environment settings page.", - exception.Message - ); - } - [Fact] /// /// Test that analytics data is consistent with concurrent calls to get flags. @@ -572,7 +554,7 @@ public async Task TestAnalyticsDataConsistencyWithConcurrentCallsToGetFlags() featuresDictionary.TryAdd($"Feature_{i}", 0); } - // When + // When var tasks = new Task[numberOfThreads]; // Create numberOfThreads threads. @@ -584,13 +566,13 @@ public async Task TestAnalyticsDataConsistencyWithConcurrentCallsToGetFlags() // Prepare an array of feature names of length callsPerThread. for (int j = 0; j < callsPerThread; j++) { - // The feature names are randomly selected from the featuresDictionary and added to the - // list of features, which represents the features that have been evaluated. + // The feature names are randomly selected from the featuresDictionary and added to the + // list of features, which represents the features that have been evaluated. string featureName = $"Feature_{new Random().Next(1, featuresDictionary.Count + 1)}"; features[j] = featureName; // The relevant key in the featuresDictionary is incremented to simulate an evaluation - // to track for that feature. + // to track for that feature. featuresDictionary[featureName]++; } diff --git a/Flagsmith.FlagsmithClient/FlagsmithClient.cs b/Flagsmith.FlagsmithClient/FlagsmithClient.cs index bf1948a..e9b7b6f 100644 --- a/Flagsmith.FlagsmithClient/FlagsmithClient.cs +++ b/Flagsmith.FlagsmithClient/FlagsmithClient.cs @@ -150,8 +150,8 @@ public FlagsmithClient( { if (!EnvironmentKey!.StartsWith("ser.")) { - throw new Exception( - "ValueError: In order to use local evaluation, please generate a server key in the environment settings page." + Console.WriteLine( + "In order to use local evaluation, please generate a server key in the environment settings page." ); } @@ -399,4 +399,4 @@ private IFlags GetIdentityFlagsFromDocument(string identifier, List? tra ~FlagsmithClient() => _pollingManager?.StopPoll(); } -} +} \ No newline at end of file