diff --git a/build/Common.props b/build/Common.props
index 5b8b6f49..0bc9bed5 100644
--- a/build/Common.props
+++ b/build/Common.props
@@ -23,8 +23,8 @@
Please sort alphabetically.
Refer to https://docs.microsoft.com/nuget/concepts/package-versioning for semver syntax.
-->
-
- [1.5,2.0)
+
+ [2.0,3.0)
diff --git a/src/OpenFeature.Contrib.Hooks.Otel/MetricsHook.cs b/src/OpenFeature.Contrib.Hooks.Otel/MetricsHook.cs
index f5fd56f9..59421f38 100644
--- a/src/OpenFeature.Contrib.Hooks.Otel/MetricsHook.cs
+++ b/src/OpenFeature.Contrib.Hooks.Otel/MetricsHook.cs
@@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Diagnostics.Metrics;
using System.Reflection;
+using System.Threading;
using System.Threading.Tasks;
using OpenFeature.Model;
@@ -36,17 +37,8 @@ public MetricsHook()
_evaluationErrorCounter = meter.CreateCounter(MetricsConstants.ErrorTotalName, description: MetricsConstants.ErrorDescription);
}
- ///
- /// Executes before the flag evaluation and captures metrics related to the evaluation.
- /// The metrics are captured in the following order:
- /// 1. The active count is incremented. (feature_flag.evaluation_active_count)
- /// 2. The request count is incremented. (feature_flag.evaluation_requests_total)
- ///
- /// The type of the flag value.
- /// The hook context.
- /// The optional hints.
- /// The evaluation context.
- public override Task Before(HookContext context, IReadOnlyDictionary hints = null)
+ ///
+ public override ValueTask BeforeAsync(HookContext context, IReadOnlyDictionary hints = null, CancellationToken cancellationToken = default)
{
var tagList = new TagList
{
@@ -57,21 +49,12 @@ public override Task Before(HookContext context, IReadO
_evaluationActiveUpDownCounter.Add(1, tagList);
_evaluationRequestCounter.Add(1, tagList);
- return base.Before(context, hints);
+ return base.BeforeAsync(context, hints);
}
- ///
- /// Executes after the flag evaluation and captures metrics related to the evaluation.
- /// The metrics are captured in the following order:
- /// 1. The success count is incremented. (feature_flag.evaluation_success_total)
- ///
- /// The type of the flag value.
- /// The hook context.
- /// The flag evaluation details.
- /// The optional hints.
- /// The evaluation context.
- public override Task After(HookContext context, FlagEvaluationDetails details, IReadOnlyDictionary hints = null)
+ ///
+ public override ValueTask AfterAsync(HookContext context, FlagEvaluationDetails details, IReadOnlyDictionary hints = null, CancellationToken cancellationToken = default)
{
var tagList = new TagList
{
@@ -83,20 +66,11 @@ public override Task After(HookContext context, FlagEvaluationDetails d
_evaluationSuccessCounter.Add(1, tagList);
- return base.After(context, details, hints);
+ return base.AfterAsync(context, details, hints);
}
- ///
- /// Executes when an error occurs during flag evaluation and captures metrics related to the error.
- /// The metrics are captured in the following order:
- /// 1. The error count is incremented. (feature_flag.evaluation_error_total)
- ///
- /// The type of the flag value.
- /// The hook context.
- /// The exception that occurred.
- /// The optional hints.
- /// The evaluation context.
- public override Task Error(HookContext context, Exception error, IReadOnlyDictionary hints = null)
+ ///
+ public override ValueTask ErrorAsync(HookContext context, Exception error, IReadOnlyDictionary hints = null, CancellationToken cancellationToken = default)
{
var tagList = new TagList
{
@@ -107,18 +81,11 @@ public override Task Error(HookContext context, Exception error, IReadOnly
_evaluationErrorCounter.Add(1, tagList);
- return base.Error(context, error, hints);
+ return base.ErrorAsync(context, error, hints);
}
- ///
- /// Executes after the flag evaluation is complete and captures metrics related to the evaluation.
- /// The active count is decremented. (feature_flag.evaluation_active_count)
- ///
- /// The type of the flag value.
- /// The hook context.
- /// The optional hints.
- /// The evaluation context.
- public override Task Finally(HookContext context, IReadOnlyDictionary hints = null)
+ ///
+ public override ValueTask FinallyAsync(HookContext context, IReadOnlyDictionary hints = null, CancellationToken cancellationToken = default)
{
var tagList = new TagList
{
@@ -128,7 +95,7 @@ public override Task Finally(HookContext context, IReadOnlyDictionary
- /// After is executed after a feature flag has been evaluated.
- ///
- /// The hook context
- /// The result of the feature flag evaluation
- /// Hints for the feature flag evaluation
- /// An awaitable Task object
- public override Task After(HookContext context, FlagEvaluationDetails details,
- IReadOnlyDictionary hints = null)
+ ///
+ public override ValueTask AfterAsync(HookContext context, FlagEvaluationDetails details,
+ IReadOnlyDictionary hints = null, CancellationToken cancellationToken = default)
{
- _tracingHook.After(context, details, hints);
+ _tracingHook.AfterAsync(context, details, hints);
- return Task.CompletedTask;
+ return default;
}
- ///
- /// Error is executed when an error during a feature flag evaluation occured.
- ///
- /// The hook context
- /// The exception thrown by feature flag provider
- /// Hints for the feature flag evaluation
- /// An awaitable Task object
- public override Task Error(HookContext context, System.Exception error,
- IReadOnlyDictionary hints = null)
+ ///
+ public override ValueTask ErrorAsync(HookContext context, System.Exception error,
+ IReadOnlyDictionary hints = null, CancellationToken cancellationToken = default)
{
- _tracingHook.Error(context, error, hints);
+ _tracingHook.ErrorAsync(context, error, hints);
- return Task.CompletedTask;
+ return default;
}
}
diff --git a/src/OpenFeature.Contrib.Hooks.Otel/README.md b/src/OpenFeature.Contrib.Hooks.Otel/README.md
index 281a78ec..737c47dd 100644
--- a/src/OpenFeature.Contrib.Hooks.Otel/README.md
+++ b/src/OpenFeature.Contrib.Hooks.Otel/README.md
@@ -48,7 +48,7 @@ namespace OpenFeatureTestApp
var client = OpenFeature.Api.Instance.GetClient("my-app");
- var val = client.GetBooleanValue("myBoolFlag", false, null);
+ var val = client.GetBooleanValueAsync("myBoolFlag", false, null);
// Print the value of the 'myBoolFlag' feature flag
System.Console.WriteLine(val.Result.ToString());
@@ -114,7 +114,7 @@ namespace OpenFeatureTestApp
var client = OpenFeature.Api.Instance.GetClient("my-app");
- var val = client.GetBooleanValue("myBoolFlag", false, null);
+ var val = client.GetBooleanValueAsync("myBoolFlag", false, null);
// Print the value of the 'myBoolFlag' feature flag
System.Console.WriteLine(val.Result.ToString());
diff --git a/src/OpenFeature.Contrib.Hooks.Otel/TracingHook.cs b/src/OpenFeature.Contrib.Hooks.Otel/TracingHook.cs
index 66692d86..baef050f 100644
--- a/src/OpenFeature.Contrib.Hooks.Otel/TracingHook.cs
+++ b/src/OpenFeature.Contrib.Hooks.Otel/TracingHook.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using OpenTelemetry.Trace;
+using System.Threading;
namespace OpenFeature.Contrib.Hooks.Otel
@@ -13,15 +14,9 @@ namespace OpenFeature.Contrib.Hooks.Otel
public class TracingHook : Hook
{
- ///
- /// After is executed after a feature flag has been evaluated.
- ///
- /// The hook context
- /// The result of the feature flag evaluation
- /// Hints for the feature flag evaluation
- /// An awaitable Task object
- public override Task After(HookContext context, FlagEvaluationDetails details,
- IReadOnlyDictionary hints = null)
+ ///
+ public override ValueTask AfterAsync(HookContext context, FlagEvaluationDetails details,
+ IReadOnlyDictionary hints = null, CancellationToken cancellationToken = default)
{
Activity.Current?
.SetTag("feature_flag.key", details.FlagKey)
@@ -34,22 +29,16 @@ public override Task After(HookContext context, FlagEvaluationDetails d
["feature_flag.provider_name"] = context.ProviderMetadata.Name
}));
- return Task.CompletedTask;
+ return default;
}
- ///
- /// Error is executed when an error during a feature flag evaluation occured.
- ///
- /// The hook context
- /// The exception thrown by feature flag provider
- /// Hints for the feature flag evaluation
- /// An awaitable Task object
- public override Task Error(HookContext context, System.Exception error,
- IReadOnlyDictionary hints = null)
+ ///
+ public override ValueTask ErrorAsync(HookContext context, System.Exception error,
+ IReadOnlyDictionary hints = null, CancellationToken cancellationToken = default)
{
Activity.Current?.RecordException(error);
- return Task.CompletedTask;
+ return default;
}
}
diff --git a/src/OpenFeature.Contrib.Providers.ConfigCat/ConfigCatProvider.cs b/src/OpenFeature.Contrib.Providers.ConfigCat/ConfigCatProvider.cs
index 36dc80a1..48f966ed 100644
--- a/src/OpenFeature.Contrib.Providers.ConfigCat/ConfigCatProvider.cs
+++ b/src/OpenFeature.Contrib.Providers.ConfigCat/ConfigCatProvider.cs
@@ -1,4 +1,5 @@
using System;
+using System.Threading;
using System.Threading.Tasks;
using ConfigCat.Client;
using ConfigCat.Client.Configuration;
@@ -35,34 +36,34 @@ public override Metadata GetMetadata()
}
///
- public override Task> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
+ public override Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
- return ResolveFlag(flagKey, context, defaultValue);
+ return ResolveFlag(flagKey, context, defaultValue, cancellationToken);
}
///
- public override Task> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
+ public override Task> ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
- return ResolveFlag(flagKey, context, defaultValue);
+ return ResolveFlag(flagKey, context, defaultValue, cancellationToken);
}
///
- public override Task> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
+ public override Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
- return ResolveFlag(flagKey, context, defaultValue);
+ return ResolveFlag(flagKey, context, defaultValue, cancellationToken);
}
///
- public override Task> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
+ public override Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
- return ResolveFlag(flagKey, context, defaultValue);
+ return ResolveFlag(flagKey, context, defaultValue, cancellationToken);
}
///
- public override async Task> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
+ public override async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
var user = context?.BuildUser();
- var result = await Client.GetValueDetailsAsync(flagKey, defaultValue?.AsObject, user);
+ var result = await Client.GetValueDetailsAsync(flagKey, defaultValue?.AsObject, user, cancellationToken);
var returnValue = result.IsDefaultValue ? defaultValue : new Value(result.Value);
var details = new ResolutionDetails(flagKey, returnValue, TranslateErrorCode(result.ErrorCode), errorMessage: result.ErrorMessage, variant: result.VariationId);
if (details.ErrorType == ErrorType.None)
@@ -73,10 +74,10 @@ public override async Task> ResolveStructureValue(strin
throw new FeatureProviderException(details.ErrorType, details.ErrorMessage);
}
- private async Task> ResolveFlag(string flagKey, EvaluationContext context, T defaultValue)
+ private async Task> ResolveFlag(string flagKey, EvaluationContext context, T defaultValue, CancellationToken cancellationToken)
{
var user = context?.BuildUser();
- var result = await Client.GetValueDetailsAsync(flagKey, defaultValue, user);
+ var result = await Client.GetValueDetailsAsync(flagKey, defaultValue, user, cancellationToken);
var details = new ResolutionDetails(flagKey, result.Value, TranslateErrorCode(result.ErrorCode), errorMessage: result.ErrorMessage, variant: result.VariationId);
if (details.ErrorType == ErrorType.None)
{
diff --git a/src/OpenFeature.Contrib.Providers.ConfigCat/README.md b/src/OpenFeature.Contrib.Providers.ConfigCat/README.md
index cf2c7060..b08e8826 100644
--- a/src/OpenFeature.Contrib.Providers.ConfigCat/README.md
+++ b/src/OpenFeature.Contrib.Providers.ConfigCat/README.md
@@ -60,7 +60,7 @@ namespace OpenFeatureTestApp
var client = OpenFeature.Api.Instance.GetClient();
- var val = client.GetBooleanValue("isMyAwesomeFeatureEnabled", false);
+ var val = client.GetBooleanValueAsync("isMyAwesomeFeatureEnabled", false);
if(isMyAwesomeFeatureEnabled)
{
diff --git a/src/OpenFeature.Contrib.Providers.FeatureManagement/FeatureManagementProvider.cs b/src/OpenFeature.Contrib.Providers.FeatureManagement/FeatureManagementProvider.cs
index 1f47894d..3653bf0e 100644
--- a/src/OpenFeature.Contrib.Providers.FeatureManagement/FeatureManagementProvider.cs
+++ b/src/OpenFeature.Contrib.Providers.FeatureManagement/FeatureManagementProvider.cs
@@ -46,7 +46,7 @@ public FeatureManagementProvider(IConfiguration configuration, FeatureManagement
public override Metadata GetMetadata() => metadata;
///
- public override async Task> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
+ public override async Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
var variant = await Evaluate(flagKey, context, CancellationToken.None);
@@ -56,7 +56,7 @@ public override async Task> ResolveBooleanValue(string f
}
///
- public override async Task> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
+ public override async Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
var variant = await Evaluate(flagKey, context, CancellationToken.None);
@@ -67,7 +67,7 @@ public override async Task> ResolveDoubleValue(string
}
///
- public override async Task> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
+ public override async Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
var variant = await Evaluate(flagKey, context, CancellationToken.None);
@@ -78,7 +78,7 @@ public override async Task> ResolveIntegerValue(string fl
}
///
- public override async Task> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
+ public override async Task> ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
var variant = await Evaluate(flagKey, context, CancellationToken.None);
@@ -89,7 +89,7 @@ public override async Task> ResolveStringValue(string
}
///
- public override async Task> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
+ public override async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
var variant = await Evaluate(flagKey, context, CancellationToken.None);
diff --git a/src/OpenFeature.Contrib.Providers.FeatureManagement/README.md b/src/OpenFeature.Contrib.Providers.FeatureManagement/README.md
index f7943fba..4a479e86 100644
--- a/src/OpenFeature.Contrib.Providers.FeatureManagement/README.md
+++ b/src/OpenFeature.Contrib.Providers.FeatureManagement/README.md
@@ -70,7 +70,7 @@ namespace OpenFeatureTestApp
var client = OpenFeature.Api.Instance.GetClient();
- var val = await client.GetBooleanValue("myBoolFlag", false, null);
+ var val = await client.GetBooleanValueAsync("myBoolFlag", false, null);
System.Console.WriteLine(val.ToString());
}
diff --git a/src/OpenFeature.Contrib.Providers.Flagd/FlagdProvider.cs b/src/OpenFeature.Contrib.Providers.Flagd/FlagdProvider.cs
index 45f383e2..2b12223c 100644
--- a/src/OpenFeature.Contrib.Providers.Flagd/FlagdProvider.cs
+++ b/src/OpenFeature.Contrib.Providers.Flagd/FlagdProvider.cs
@@ -7,6 +7,7 @@
using Value = OpenFeature.Model.Value;
using OpenFeature.Constant;
using System.Diagnostics.Tracing;
+using System.Threading;
namespace OpenFeature.Contrib.Providers.Flagd
{
@@ -17,9 +18,7 @@ public sealed class FlagdProvider : FeatureProvider
{
const string ProviderName = "flagd Provider";
private readonly FlagdConfig _config;
- private ProviderStatus _status = ProviderStatus.NotReady;
private readonly Metadata _providerMetadata = new Metadata(ProviderName);
-
private readonly Resolver.Resolver _resolver;
///
@@ -85,12 +84,6 @@ internal FlagdProvider(Resolver.Resolver resolver)
_resolver.Init();
}
- ///
- public override ProviderStatus GetStatus()
- {
- return _status;
- }
-
// just for testing, internal but visible in tests
internal FlagdConfig GetConfig() => _config;
@@ -113,91 +106,58 @@ public static string GetProviderName()
internal Resolver.Resolver GetResolver() => _resolver;
///
- public override Task Initialize(EvaluationContext context)
+ public override Task InitializeAsync(EvaluationContext context, CancellationToken cancellationToken = default)
{
return Task.Run(async () =>
{
await _resolver.Init();
- _status = ProviderStatus.Ready;
}).ContinueWith((t) =>
{
if (t.IsFaulted)
{
- _status = ProviderStatus.Error;
throw t.Exception;
};
});
}
///
- public override Task Shutdown()
+ public override Task ShutdownAsync(CancellationToken cancellationToken = default)
{
return _resolver.Shutdown().ContinueWith((t) =>
{
- _status = ProviderStatus.NotReady;
if (t.IsFaulted) throw t.Exception;
});
}
- ///
- /// ResolveBooleanValue resolve the value for a Boolean Flag.
- ///
- /// Name of the flag
- /// Default value used in case of error.
- /// Context about the user
- /// A ResolutionDetails object containing the value of your flag
- public override async Task> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
+ ///
+ public override async Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
- return await _resolver.ResolveBooleanValue(flagKey, defaultValue, context).ConfigureAwait(false);
+ return await _resolver.ResolveBooleanValueAsync(flagKey, defaultValue, context).ConfigureAwait(false);
}
- ///
- /// ResolveStringValue resolve the value for a string Flag.
- ///
- /// Name of the flag
- /// Default value used in case of error.
- /// Context about the user
- /// A ResolutionDetails object containing the value of your flag
- public override async Task> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
+ ///
+ public override async Task> ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
- return await _resolver.ResolveStringValue(flagKey, defaultValue, context).ConfigureAwait(false);
+ return await _resolver.ResolveStringValueAsync(flagKey, defaultValue, context).ConfigureAwait(false);
}
- ///
- /// ResolveIntegerValue resolve the value for an int Flag.
- ///
- /// Name of the flag
- /// Default value used in case of error.
- /// Context about the user
- /// A ResolutionDetails object containing the value of your flag
- public override async Task> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
+ ///
+ public override async Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
- return await _resolver.ResolveIntegerValue(flagKey, defaultValue, context).ConfigureAwait(false);
+ return await _resolver.ResolveIntegerValueAsync(flagKey, defaultValue, context).ConfigureAwait(false);
}
- ///
- /// ResolveDoubleValue resolve the value for a double Flag.
- ///
- /// Name of the flag
- /// Default value used in case of error.
- /// Context about the user
- /// A ResolutionDetails object containing the value of your flag
- public override async Task> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
+ ///
+ public override async Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
- return await _resolver.ResolveDoubleValue(flagKey, defaultValue, context).ConfigureAwait(false);
+ return await _resolver.ResolveDoubleValueAsync(flagKey, defaultValue, context).ConfigureAwait(false);
}
- ///
- /// ResolveStructureValue resolve the value for a Boolean Flag.
- ///
- /// Name of the flag
- /// Default value used in case of error.
- /// Context about the user
- /// A ResolutionDetails object containing the value of your flag
- public override async Task> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
+ ///
+ public override async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
- return await _resolver.ResolveStructureValue(flagKey, defaultValue, context).ConfigureAwait(false);
+ return await _resolver.ResolveStructureValueAsync(flagKey, defaultValue, context).ConfigureAwait(false);
}
}
}
diff --git a/src/OpenFeature.Contrib.Providers.Flagd/README.md b/src/OpenFeature.Contrib.Providers.Flagd/README.md
index 9e07ad82..e1f575f5 100644
--- a/src/OpenFeature.Contrib.Providers.Flagd/README.md
+++ b/src/OpenFeature.Contrib.Providers.Flagd/README.md
@@ -67,7 +67,7 @@ namespace OpenFeatureTestApp
var client = OpenFeature.Api.Instance.GetClient("my-app");
- var val = client.GetBooleanValue("myBoolFlag", false, null);
+ var val = client.GetBooleanValueAsync("myBoolFlag", false, null);
// Print the value of the 'myBoolFlag' feature flag
System.Console.WriteLine(val.Result.ToString());
@@ -151,7 +151,7 @@ namespace OpenFeatureTestApp
var client = OpenFeature.Api.Instance.GetClient("my-app");
- var val = client.GetBooleanValue("myBoolFlag", false, null);
+ var val = client.GetBooleanValueAsync("myBoolFlag", false, null);
// Print the value of the 'myBoolFlag' feature flag
System.Console.WriteLine(val.Result.ToString());
diff --git a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/InProcessResolver.cs b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/InProcessResolver.cs
index 2d68f4bc..23059c3d 100644
--- a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/InProcessResolver.cs
+++ b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/InProcessResolver.cs
@@ -76,29 +76,29 @@ public Task Shutdown()
});
}
- public Task> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
+ public Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext context = null)
{
- return Task.FromResult(_evaluator.ResolveBooleanValue(flagKey, defaultValue, context));
+ return Task.FromResult(_evaluator.ResolveBooleanValueAsync(flagKey, defaultValue, context));
}
- public Task> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
+ public Task> ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext context = null)
{
- return Task.FromResult(_evaluator.ResolveStringValue(flagKey, defaultValue, context));
+ return Task.FromResult(_evaluator.ResolveStringValueAsync(flagKey, defaultValue, context));
}
- public Task> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
+ public Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext context = null)
{
- return Task.FromResult(_evaluator.ResolveIntegerValue(flagKey, defaultValue, context));
+ return Task.FromResult(_evaluator.ResolveIntegerValueAsync(flagKey, defaultValue, context));
}
- public Task> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
+ public Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext context = null)
{
- return Task.FromResult(_evaluator.ResolveDoubleValue(flagKey, defaultValue, context));
+ return Task.FromResult(_evaluator.ResolveDoubleValueAsync(flagKey, defaultValue, context));
}
- public Task> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
+ public Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext context = null)
{
- return Task.FromResult(_evaluator.ResolveStructureValue(flagKey, defaultValue, context));
+ return Task.FromResult(_evaluator.ResolveStructureValueAsync(flagKey, defaultValue, context));
}
private async void HandleEvents(CountdownEvent latch)
diff --git a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/JsonEvaluator.cs b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/JsonEvaluator.cs
index 5828f88d..6154982e 100644
--- a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/JsonEvaluator.cs
+++ b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/JsonEvaluator.cs
@@ -122,27 +122,27 @@ internal void Sync(FlagConfigurationUpdateType updateType, string flagConfigurat
}
}
- public ResolutionDetails ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
+ public ResolutionDetails ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext context = null)
{
return ResolveValue(flagKey, defaultValue, context);
}
- public ResolutionDetails ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
+ public ResolutionDetails ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext context = null)
{
return ResolveValue(flagKey, defaultValue, context);
}
- public ResolutionDetails ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
+ public ResolutionDetails ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext context = null)
{
return ResolveValue(flagKey, defaultValue, context);
}
- public ResolutionDetails ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
+ public ResolutionDetails ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext context = null)
{
return ResolveValue(flagKey, defaultValue, context);
}
- public ResolutionDetails ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
+ public ResolutionDetails ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext context = null)
{
return ResolveValue(flagKey, defaultValue, context);
}
diff --git a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/Resolver.cs b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/Resolver.cs
index c28e73ce..c80c6d63 100644
--- a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/Resolver.cs
+++ b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/Resolver.cs
@@ -9,19 +9,19 @@ internal interface Resolver
Task Init();
Task Shutdown();
- Task> ResolveBooleanValue(string flagKey, bool defaultValue,
+ Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue,
EvaluationContext context = null);
- Task> ResolveStringValue(string flagKey, string defaultValue,
+ Task> ResolveStringValueAsync(string flagKey, string defaultValue,
EvaluationContext context = null);
- Task> ResolveIntegerValue(string flagKey, int defaultValue,
+ Task> ResolveIntegerValueAsync(string flagKey, int defaultValue,
EvaluationContext context = null);
- Task> ResolveDoubleValue(string flagKey, double defaultValue,
+ Task> ResolveDoubleValueAsync(string flagKey, double defaultValue,
EvaluationContext context = null);
- Task> ResolveStructureValue(string flagKey, Value defaultValue,
+ Task> ResolveStructureValueAsync(string flagKey, Value defaultValue,
EvaluationContext context = null);
}
}
diff --git a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/Rpc/RpcResolver.cs b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/Rpc/RpcResolver.cs
index ef5ccf2b..6c5a38b5 100644
--- a/src/OpenFeature.Contrib.Providers.Flagd/Resolver/Rpc/RpcResolver.cs
+++ b/src/OpenFeature.Contrib.Providers.Flagd/Resolver/Rpc/RpcResolver.cs
@@ -73,7 +73,7 @@ public Task Shutdown()
});
}
- public async Task> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
+ public async Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext context = null)
{
return await ResolveValue(flagKey, async contextStruct =>
{
@@ -92,7 +92,7 @@ public async Task> ResolveBooleanValue(string flagKey, b
}, context);
}
- public async Task> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
+ public async Task> ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext context = null)
{
return await ResolveValue(flagKey, async contextStruct =>
{
@@ -111,7 +111,7 @@ public async Task> ResolveStringValue(string flagKey,
}, context);
}
- public async Task> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
+ public async Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext context = null)
{
return await ResolveValue(flagKey, async contextStruct =>
{
@@ -130,7 +130,7 @@ public async Task> ResolveIntegerValue(string flagKey, in
}, context);
}
- public async Task> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
+ public async Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext context = null)
{
return await ResolveValue(flagKey, async contextStruct =>
{
@@ -149,7 +149,7 @@ public async Task> ResolveDoubleValue(string flagKey,
}, context);
}
- public async Task> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
+ public async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext context = null)
{
return await ResolveValue(flagKey, async contextStruct =>
{
diff --git a/src/OpenFeature.Contrib.Providers.Flagsmith/FlagsmithProvider.cs b/src/OpenFeature.Contrib.Providers.Flagsmith/FlagsmithProvider.cs
index 66ee0fd9..ac4ab10e 100644
--- a/src/OpenFeature.Contrib.Providers.Flagsmith/FlagsmithProvider.cs
+++ b/src/OpenFeature.Contrib.Providers.Flagsmith/FlagsmithProvider.cs
@@ -10,6 +10,7 @@
using Trait = Flagsmith.Trait;
using OpenFeature.Error;
using System.Globalization;
+using System.Threading;
namespace OpenFeature.Contrib.Providers.Flagsmith
{
@@ -108,27 +109,27 @@ private async Task> IsFeatureEnabled(string flagKey, Eva
///
- public override Task> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
+ public override Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
=> Configuration.UsingBooleanConfigValue
? ResolveValue(flagKey, defaultValue, bool.TryParse, context)
: IsFeatureEnabled(flagKey, context);
///
- public override Task> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
+ public override Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
=> ResolveValue(flagKey, defaultValue, int.TryParse, context);
///
- public override Task> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
+ public override Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
=> ResolveValue(flagKey, defaultValue, (string x, out double y) => double.TryParse(x, NumberStyles.Any, CultureInfo.InvariantCulture, out y), context);
///
- public override Task> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
+ public override Task> ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
=> ResolveValue(flagKey, defaultValue, (string x, out string y) => { y = x; return true; }, context);
///
- public override Task> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
+ public override Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
=> ResolveValue(flagKey, defaultValue, TryParseValue, context);
private bool TryParseValue(string stringValue, out Value result)
diff --git a/src/OpenFeature.Contrib.Providers.Flagsmith/README.md b/src/OpenFeature.Contrib.Providers.Flagsmith/README.md
index c4b07c69..827ef72e 100644
--- a/src/OpenFeature.Contrib.Providers.Flagsmith/README.md
+++ b/src/OpenFeature.Contrib.Providers.Flagsmith/README.md
@@ -79,7 +79,7 @@ var context = EvaluationContext.Builder()
.Build();
// Evaluate a flag
-var val = await client.GetBooleanValue("myBoolFlag", false, context);
+var val = await client.GetBooleanValueAsync("myBoolFlag", false, context);
// Print the value of the 'myBoolFlag' feature flag
Console.WriteLine(val);
diff --git a/src/OpenFeature.Contrib.Providers.GOFeatureFlag/GoFeatureFlagProvider.cs b/src/OpenFeature.Contrib.Providers.GOFeatureFlag/GoFeatureFlagProvider.cs
index 0426dff7..82b7994d 100644
--- a/src/OpenFeature.Contrib.Providers.GOFeatureFlag/GoFeatureFlagProvider.cs
+++ b/src/OpenFeature.Contrib.Providers.GOFeatureFlag/GoFeatureFlagProvider.cs
@@ -6,6 +6,7 @@
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
+using System.Threading;
using System.Threading.Tasks;
using OpenFeature.Constant;
using OpenFeature.Contrib.Providers.GOFeatureFlag.exception;
@@ -78,18 +79,19 @@ public override Metadata GetMetadata()
}
///
- /// ResolveBooleanValue resolve the value for a Boolean Flag.
+ /// ResolveBooleanValueAsync resolve the value for a Boolean Flag.
///
/// Name of the flag
/// Default value used in case of error.
/// Context about the user
+ /// Token for cancel the async operation
/// A ResolutionDetails object containing the value of your flag
/// If the type of the flag does not match
/// If the flag does not exists
/// If an unknown error happen
/// If the flag is disabled
- public override async Task> ResolveBooleanValue(string flagKey, bool defaultValue,
- EvaluationContext context = null)
+ public override async Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue,
+ EvaluationContext context = null, CancellationToken cancellationToken = default)
{
try
{
@@ -108,18 +110,19 @@ public override async Task> ResolveBooleanValue(string f
}
///
- /// ResolveBooleanValue resolve the value for a string Flag.
+ /// ResolveBooleanValueAsync resolve the value for a string Flag.
///
/// Name of the flag
/// Default value used in case of error.
/// Context about the user
+ /// Token for cancel the async operation
/// A ResolutionDetails object containing the value of your flag
/// If the type of the flag does not match
/// If the flag does not exists
/// If an unknown error happen
/// If the flag is disabled
- public override async Task> ResolveStringValue(string flagKey, string defaultValue,
- EvaluationContext context = null)
+ public override async Task> ResolveStringValueAsync(string flagKey, string defaultValue,
+ EvaluationContext context = null, CancellationToken cancellationToken = default)
{
try
{
@@ -140,18 +143,19 @@ public override async Task> ResolveStringValue(string
}
///
- /// ResolveBooleanValue resolve the value for an int Flag.
+ /// ResolveBooleanValueAsync resolve the value for an int Flag.
///
/// Name of the flag
/// Default value used in case of error.
/// Context about the user
+ /// Token for cancel the async operation
/// A ResolutionDetails object containing the value of your flag
/// If the type of the flag does not match
/// If the flag does not exists
/// If an unknown error happen
/// If the flag is disabled
- public override async Task> ResolveIntegerValue(string flagKey, int defaultValue,
- EvaluationContext context = null)
+ public override async Task> ResolveIntegerValueAsync(string flagKey, int defaultValue,
+ EvaluationContext context = null, CancellationToken cancellationToken = default)
{
try
{
@@ -170,18 +174,19 @@ public override async Task> ResolveIntegerValue(string fl
}
///
- /// ResolveBooleanValue resolve the value for a double Flag.
+ /// ResolveBooleanValueAsync resolve the value for a double Flag.
///
/// Name of the flag
/// Default value used in case of error.
/// Context about the user
+ /// Token for cancel the async operation
/// A ResolutionDetails object containing the value of your flag
/// If the type of the flag does not match
/// If the flag does not exists
/// If an unknown error happen
/// If the flag is disabled
- public override async Task> ResolveDoubleValue(string flagKey, double defaultValue,
- EvaluationContext context = null)
+ public override async Task> ResolveDoubleValueAsync(string flagKey, double defaultValue,
+ EvaluationContext context = null, CancellationToken cancellationToken = default)
{
try
{
@@ -201,18 +206,19 @@ public override async Task> ResolveDoubleValue(string
}
///
- /// ResolveBooleanValue resolve the value for a Boolean Flag.
+ /// ResolveBooleanValueAsync resolve the value for a Boolean Flag.
///
/// Name of the flag
/// Default value used in case of error.
/// Context about the user
+ /// Token for cancel the async operation
/// A ResolutionDetails object containing the value of your flag
/// If the type of the flag does not match
/// If the flag does not exists
/// If an unknown error happen
/// If the flag is disabled
- public override async Task> ResolveStructureValue(string flagKey, Value defaultValue,
- EvaluationContext context = null)
+ public override async Task> ResolveStructureValueAsync(string flagKey, Value defaultValue,
+ EvaluationContext context = null, CancellationToken cancellationToken = default)
{
try
{
diff --git a/src/OpenFeature.Contrib.Providers.GOFeatureFlag/OpenFeature.Contrib.Providers.GOFeatureFlag.csproj b/src/OpenFeature.Contrib.Providers.GOFeatureFlag/OpenFeature.Contrib.Providers.GOFeatureFlag.csproj
index ae9f658d..df81a1c5 100644
--- a/src/OpenFeature.Contrib.Providers.GOFeatureFlag/OpenFeature.Contrib.Providers.GOFeatureFlag.csproj
+++ b/src/OpenFeature.Contrib.Providers.GOFeatureFlag/OpenFeature.Contrib.Providers.GOFeatureFlag.csproj
@@ -12,6 +12,7 @@
+
diff --git a/src/OpenFeature.Contrib.Providers.GOFeatureFlag/README.md b/src/OpenFeature.Contrib.Providers.GOFeatureFlag/README.md
index b40345a9..ac8e8caa 100644
--- a/src/OpenFeature.Contrib.Providers.GOFeatureFlag/README.md
+++ b/src/OpenFeature.Contrib.Providers.GOFeatureFlag/README.md
@@ -88,7 +88,7 @@ var userContext = EvaluationContext.Builder()
.Set("anonymous", false)
.Build();
-var adminFlag = await client.GetBooleanValue("flag-only-for-admin", false, userContext);
+var adminFlag = await client.GetBooleanValueAsync("flag-only-for-admin", false, userContext);
if (adminFlag) {
// flag "flag-only-for-admin" is true for the user
} else {
diff --git a/src/OpenFeature.Contrib.Providers.Statsig/README.md b/src/OpenFeature.Contrib.Providers.Statsig/README.md
index 6e0e4b78..c33d56d9 100644
--- a/src/OpenFeature.Contrib.Providers.Statsig/README.md
+++ b/src/OpenFeature.Contrib.Providers.Statsig/README.md
@@ -1,6 +1,6 @@
# Statsig Feature Flag .NET Provider
-The Statsig Flag provider allows you to connect to Statsig. Please note this is a minimal implementation - only `ResolveBooleanValue` is implemented.
+The Statsig Flag provider allows you to connect to Statsig. Please note this is a minimal implementation - only `ResolveBooleanValueAsync` is implemented.
# .Net SDK usage
@@ -61,7 +61,7 @@ eb.SetTargetingKey("john@doe.acme");
IFeatureClient client = Api.Instance.GetClient(context: eb.Build());
-bool isMyAwesomeFeatureEnabled = await client.GetBooleanValue("isMyAwesomeFeatureEnabled", false);
+bool isMyAwesomeFeatureEnabled = await client.GetBooleanValueAsync("isMyAwesomeFeatureEnabled", false);
if (isMyAwesomeFeatureEnabled)
{
@@ -97,4 +97,4 @@ The following parameters are mapped to the corresponding Statsig pre-defined par
| `privateAttributes` | `PrivateAttributes` |
## Known issues and limitations
-- Only `ResolveBooleanValue` implemented for now
+- Only `ResolveBooleanValueAsync` implemented for now
diff --git a/src/OpenFeature.Contrib.Providers.Statsig/StatsigProvider.cs b/src/OpenFeature.Contrib.Providers.Statsig/StatsigProvider.cs
index b6bff9bc..5fa395d6 100644
--- a/src/OpenFeature.Contrib.Providers.Statsig/StatsigProvider.cs
+++ b/src/OpenFeature.Contrib.Providers.Statsig/StatsigProvider.cs
@@ -4,6 +4,7 @@
using Statsig.Server;
using Statsig.Server.Evaluation;
using System;
+using System.Threading;
using System.Threading.Tasks;
namespace OpenFeature.Contrib.Providers.Statsig
@@ -21,7 +22,6 @@ namespace OpenFeature.Contrib.Providers.Statsig
///
public sealed class StatsigProvider : FeatureProvider
{
- volatile bool initialized = false;
private readonly Metadata _providerMetadata = new Metadata("Statsig provider");
private readonly string _sdkKey = "secret-"; //Dummy sdk key that works with local mode
internal readonly ServerDriver ServerDriver;
@@ -44,7 +44,7 @@ public StatsigProvider(string sdkKey = null, StatsigServerOptions statsigServerO
public override Metadata GetMetadata() => _providerMetadata;
///
- public override Task> ResolveBooleanValue(string flagKey, bool defaultValue, EvaluationContext context = null)
+ public override Task> ResolveBooleanValueAsync(string flagKey, bool defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
var result = ServerDriver.GetFeatureGate(context.AsStatsigUser(), flagKey);
var gateFound = false;
@@ -77,47 +77,37 @@ public override Task> ResolveBooleanValue(string flagKey
}
///
- public override Task> ResolveDoubleValue(string flagKey, double defaultValue, EvaluationContext context = null)
+ public override Task> ResolveDoubleValueAsync(string flagKey, double defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
///
- public override Task> ResolveIntegerValue(string flagKey, int defaultValue, EvaluationContext context = null)
+ public override Task> ResolveIntegerValueAsync(string flagKey, int defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
///
- public override Task> ResolveStringValue(string flagKey, string defaultValue, EvaluationContext context = null)
+ public override Task> ResolveStringValueAsync(string flagKey, string defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
///
- public override Task> ResolveStructureValue(string flagKey, Value defaultValue, EvaluationContext context = null)
+ public override Task> ResolveStructureValueAsync(string flagKey, Value defaultValue, EvaluationContext context = null, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
///
- public override ProviderStatus GetStatus()
+ public override async Task InitializeAsync(EvaluationContext context, CancellationToken cancellationToken = default)
{
- return initialized ? ProviderStatus.Ready : ProviderStatus.NotReady;
+ await ServerDriver.Initialize();
}
///
- public override async Task Initialize(EvaluationContext context)
- {
- var initResult = await ServerDriver.Initialize();
- if (initResult == InitializeResult.Success || initResult == InitializeResult.LocalMode || initResult == InitializeResult.AlreadyInitialized)
- {
- initialized = true;
- }
- }
-
- ///
- public override Task Shutdown()
+ public override Task ShutdownAsync(CancellationToken cancellationToken = default)
{
return ServerDriver.Shutdown();
}
diff --git a/test/OpenFeature.Contrib.Hooks.Otel.Test/MetricsHookTest.cs b/test/OpenFeature.Contrib.Hooks.Otel.Test/MetricsHookTest.cs
index 6a3536f6..92b22304 100644
--- a/test/OpenFeature.Contrib.Hooks.Otel.Test/MetricsHookTest.cs
+++ b/test/OpenFeature.Contrib.Hooks.Otel.Test/MetricsHookTest.cs
@@ -33,7 +33,7 @@ public async void After_Test()
var otelHook = new MetricsHook();
// Act
- await otelHook.After(hookContext, new FlagEvaluationDetails("my-flag", "foo", Constant.ErrorType.None, "STATIC", "default"), new Dictionary());
+ await otelHook.AfterAsync(hookContext, new FlagEvaluationDetails("my-flag", "foo", Constant.ErrorType.None, "STATIC", "default"), new Dictionary());
// Flush metrics
meterProvider.ForceFlush();
@@ -57,7 +57,7 @@ public async void Error_Test()
var otelHook = new MetricsHook();
// Act
- await otelHook.Error(hookContext, new Exception(), new Dictionary());
+ await otelHook.ErrorAsync(hookContext, new Exception(), new Dictionary());
// Flush metrics
meterProvider.ForceFlush();
@@ -81,7 +81,7 @@ public async void Finally_Test()
var otelHook = new MetricsHook();
// Act
- await otelHook.Finally(hookContext, new Dictionary());
+ await otelHook.FinallyAsync(hookContext, new Dictionary());
// Flush metrics
meterProvider.ForceFlush();
@@ -107,7 +107,7 @@ public async void Before_Test()
var otelHook = new MetricsHook();
// Act
- await otelHook.Before(hookContext, new Dictionary());
+ await otelHook.BeforeAsync(hookContext, new Dictionary());
// Flush metrics
meterProvider.ForceFlush();
diff --git a/test/OpenFeature.Contrib.Hooks.Otel.Test/TracingHookTest.cs b/test/OpenFeature.Contrib.Hooks.Otel.Test/TracingHookTest.cs
index a719d6a9..20aade03 100644
--- a/test/OpenFeature.Contrib.Hooks.Otel.Test/TracingHookTest.cs
+++ b/test/OpenFeature.Contrib.Hooks.Otel.Test/TracingHookTest.cs
@@ -38,7 +38,7 @@ public void TestAfter()
var ctx = new HookContext("my-flag", "foo", Constant.FlagValueType.String, new ClientMetadata("my-client", "1.0"), new Metadata("my-provider"), evaluationContext);
- var hookTask = otelHook.After(ctx, new FlagEvaluationDetails("my-flag", "foo", Constant.ErrorType.None, "STATIC", "default"), new Dictionary());
+ var hookTask = otelHook.AfterAsync(ctx, new FlagEvaluationDetails("my-flag", "foo", Constant.ErrorType.None, "STATIC", "default"), new Dictionary());
Assert.True(hookTask.IsCompleted);
@@ -99,7 +99,7 @@ public void TestAfterNoSpan()
var ctx = new HookContext("my-flag", "foo", Constant.FlagValueType.String, new ClientMetadata("my-client", "1.0"), new Metadata("my-provider"), evaluationContext);
- var hookTask = otelHook.After(ctx, new FlagEvaluationDetails("my-flag", "foo", Constant.ErrorType.None, "STATIC", "default"), new Dictionary());
+ var hookTask = otelHook.AfterAsync(ctx, new FlagEvaluationDetails("my-flag", "foo", Constant.ErrorType.None, "STATIC", "default"), new Dictionary());
Assert.True(hookTask.IsCompleted);
@@ -132,7 +132,7 @@ public void TestError()
var ctx = new HookContext("my-flag", "foo", Constant.FlagValueType.String, new ClientMetadata("my-client", "1.0"), new Metadata("my-provider"), evaluationContext);
- var hookTask = otelHook.Error(ctx, new System.Exception("unexpected error"), new Dictionary());
+ var hookTask = otelHook.ErrorAsync(ctx, new System.Exception("unexpected error"), new Dictionary());
Assert.True(hookTask.IsCompleted);
@@ -181,7 +181,7 @@ public void TestErrorNoSpan()
var ctx = new HookContext("my-flag", "foo", Constant.FlagValueType.String, new ClientMetadata("my-client", "1.0"), new Metadata("my-provider"), evaluationContext);
- var hookTask = otelHook.Error(ctx, new System.Exception("unexpected error"), new Dictionary());
+ var hookTask = otelHook.ErrorAsync(ctx, new System.Exception("unexpected error"), new Dictionary());
Assert.True(hookTask.IsCompleted);
diff --git a/test/OpenFeature.Contrib.Providers.ConfigCat.Test/ConfigCatProviderTest.cs b/test/OpenFeature.Contrib.Providers.ConfigCat.Test/ConfigCatProviderTest.cs
index cae044f9..1a478f03 100644
--- a/test/OpenFeature.Contrib.Providers.ConfigCat.Test/ConfigCatProviderTest.cs
+++ b/test/OpenFeature.Contrib.Providers.ConfigCat.Test/ConfigCatProviderTest.cs
@@ -25,54 +25,54 @@ public void CreateConfigCatProvider_WithSdkKey_CreatesProviderInstanceSuccessful
[Theory]
[InlineAutoData(true, false, true)]
[InlineAutoData(false, true, false)]
- public Task GetBooleanValue_ForFeature_ReturnExpectedResult(object value, bool defaultValue, bool expectedValue, string sdkKey)
+ public Task GetBooleanValueAsync_ForFeature_ReturnExpectedResult(object value, bool defaultValue, bool expectedValue, string sdkKey)
{
- return ExecuteResolveTest(value, defaultValue, expectedValue, sdkKey, (provider, key, def) => provider.ResolveBooleanValue(key, def));
+ return ExecuteResolveTest(value, defaultValue, expectedValue, sdkKey, (provider, key, def) => provider.ResolveBooleanValueAsync(key, def));
}
[Theory]
[InlineAutoData("false", true, ErrorType.TypeMismatch)]
- public Task GetBooleanValue_ForFeature_ShouldThrowException(object value, bool defaultValue, ErrorType expectedErrorType, string sdkKey)
+ public Task GetBooleanValueAsync_ForFeature_ShouldThrowException(object value, bool defaultValue, ErrorType expectedErrorType, string sdkKey)
{
- return ExecuteResolveErrorTest(value, defaultValue, expectedErrorType, sdkKey, (provider, key, def) => provider.ResolveBooleanValue(key, def));
+ return ExecuteResolveErrorTest(value, defaultValue, expectedErrorType, sdkKey, (provider, key, def) => provider.ResolveBooleanValueAsync(key, def));
}
[Theory]
[InlineAutoData(1.0, 2.0, 1.0)]
- public Task GetDoubleValue_ForFeature_ReturnExpectedResult(object value, double defaultValue, double expectedValue, string sdkKey)
+ public Task GetDoubleValueAsync_ForFeature_ReturnExpectedResult(object value, double defaultValue, double expectedValue, string sdkKey)
{
- return ExecuteResolveTest(value, defaultValue, expectedValue, sdkKey, (provider, key, def) => provider.ResolveDoubleValue(key, def));
+ return ExecuteResolveTest(value, defaultValue, expectedValue, sdkKey, (provider, key, def) => provider.ResolveDoubleValueAsync(key, def));
}
[Theory]
[InlineAutoData(1, 0, ErrorType.TypeMismatch)]
[InlineAutoData("false", 0, ErrorType.TypeMismatch)]
[InlineAutoData(false, 0, ErrorType.TypeMismatch)]
- public Task GetDoubleValue_ForFeature_ShouldThrowException(object value, double defaultValue, ErrorType expectedErrorType, string sdkKey)
+ public Task GetDoubleValueAsync_ForFeature_ShouldThrowException(object value, double defaultValue, ErrorType expectedErrorType, string sdkKey)
{
- return ExecuteResolveErrorTest(value, defaultValue, expectedErrorType, sdkKey, (provider, key, def) => provider.ResolveDoubleValue(key, def));
+ return ExecuteResolveErrorTest(value, defaultValue, expectedErrorType, sdkKey, (provider, key, def) => provider.ResolveDoubleValueAsync(key, def));
}
[Theory]
[InlineAutoData("some-value", "empty", "some-value")]
- public Task GetStringValue_ForFeature_ReturnExpectedResult(object value, string defaultValue, string expectedValue, string sdkKey)
+ public Task GetStringValueAsync_ForFeature_ReturnExpectedResult(object value, string defaultValue, string expectedValue, string sdkKey)
{
- return ExecuteResolveTest(value, defaultValue, expectedValue, sdkKey, (provider, key, def) => provider.ResolveStringValue(key, def));
+ return ExecuteResolveTest(value, defaultValue, expectedValue, sdkKey, (provider, key, def) => provider.ResolveStringValueAsync(key, def));
}
[Theory]
[InlineAutoData(1, "empty", ErrorType.TypeMismatch)]
[InlineAutoData(false, "empty", ErrorType.TypeMismatch)]
- public Task GetStringValue_ForFeature_ShouldThrowException(object value, string defaultValue, ErrorType expectedErrorType, string sdkKey)
+ public Task GetStringValueAsync_ForFeature_ShouldThrowException(object value, string defaultValue, ErrorType expectedErrorType, string sdkKey)
{
- return ExecuteResolveErrorTest(value, defaultValue, expectedErrorType, sdkKey, (provider, key, def) => provider.ResolveStringValue(key, def));
+ return ExecuteResolveErrorTest(value, defaultValue, expectedErrorType, sdkKey, (provider, key, def) => provider.ResolveStringValueAsync(key, def));
}
[Theory]
[InlineAutoData(1, 2, 1)]
public Task GetIntValue_ForFeature_ReturnExpectedResult(object value, int defaultValue, int expectedValue, string sdkKey)
{
- return ExecuteResolveTest(value, defaultValue, expectedValue, sdkKey, (provider, key, def) => provider.ResolveIntegerValue(key, def));
+ return ExecuteResolveTest(value, defaultValue, expectedValue, sdkKey, (provider, key, def) => provider.ResolveIntegerValueAsync(key, def));
}
[Theory]
@@ -81,19 +81,19 @@ public Task GetIntValue_ForFeature_ReturnExpectedResult(object value, int defaul
[InlineAutoData(false, 0, ErrorType.TypeMismatch)]
public Task GetIntValue_ForFeature_ShouldThrowException(object value, int defaultValue, ErrorType expectedErrorType, string sdkKey)
{
- return ExecuteResolveErrorTest(value, defaultValue, expectedErrorType, sdkKey, (provider, key, def) => provider.ResolveIntegerValue(key, def));
+ return ExecuteResolveErrorTest(value, defaultValue, expectedErrorType, sdkKey, (provider, key, def) => provider.ResolveIntegerValueAsync(key, def));
}
[Theory]
[AutoData]
- public async Task GetStructureValue_ForFeature_ReturnExpectedResult(string sdkKey)
+ public async Task GetStructureValueAsync_ForFeature_ReturnExpectedResult(string sdkKey)
{
const string jsonValue = "{ \"key\": \"value\" }";
var defaultValue = new Value(jsonValue);
var configCatProvider = new ConfigCatProvider(sdkKey,
options => { options.FlagOverrides = BuildFlagOverrides(("example-feature", defaultValue.AsString)); });
- var result = await configCatProvider.ResolveStructureValue("example-feature", defaultValue);
+ var result = await configCatProvider.ResolveStructureValueAsync("example-feature", defaultValue);
Assert.Equal(defaultValue.AsString, result.Value.AsString);
Assert.Equal("example-feature", result.FlagKey);
diff --git a/test/OpenFeature.Contrib.Providers.FeatureManagement.Test/FeatureManagementProviderTestNoContext.cs b/test/OpenFeature.Contrib.Providers.FeatureManagement.Test/FeatureManagementProviderTestNoContext.cs
index 27c41ee0..cbaddc35 100644
--- a/test/OpenFeature.Contrib.Providers.FeatureManagement.Test/FeatureManagementProviderTestNoContext.cs
+++ b/test/OpenFeature.Contrib.Providers.FeatureManagement.Test/FeatureManagementProviderTestNoContext.cs
@@ -19,7 +19,7 @@ public async Task BooleanValue_ShouldReturnExpected(string key, bool defaultValu
// Act
// Invert the expected value to ensure that the value is being read from the configuration
- var result = await provider.ResolveBooleanValue(key, defaultValue);
+ var result = await provider.ResolveBooleanValueAsync(key, defaultValue);
// Assert
Assert.Equal(expectedValue, result.Value);
@@ -37,7 +37,7 @@ public async Task DoubleValue_ShouldReturnExpected(string key, double defaultVal
// Act
// Using 0.0 for the default to verify the value is being read from the configuration
- var result = await provider.ResolveDoubleValue(key, defaultValue);
+ var result = await provider.ResolveDoubleValueAsync(key, defaultValue);
// Assert
Assert.Equal(expectedValue, result.Value);
@@ -55,7 +55,7 @@ public async Task IntegerValue_ShouldReturnExpected(string key, int defaultValue
// Act
// Using 0 for the default to verify the value is being read from the configuration
- var result = await provider.ResolveIntegerValue(key, defaultValue);
+ var result = await provider.ResolveIntegerValueAsync(key, defaultValue);
// Assert
Assert.Equal(expectedValue, result.Value);
@@ -73,7 +73,7 @@ public async Task StringValue_ShouldReturnExpected(string key, string defaultVal
// Act
// Using 0 for the default to verify the value is being read from the configuration
- var result = await provider.ResolveStringValue(key, defaultValue);
+ var result = await provider.ResolveStringValueAsync(key, defaultValue);
// Assert
Assert.Equal(expectedValue, result.Value);
@@ -91,7 +91,7 @@ public async Task StructureValue_ShouldReturnExpected(string key)
// Act
// Using 0 for the default to verify the value is being read from the configuration
- var result = await provider.ResolveStructureValue(key, null);
+ var result = await provider.ResolveStructureValueAsync(key, null);
// Assert
Assert.NotNull(result);
diff --git a/test/OpenFeature.Contrib.Providers.FeatureManagement.Test/FeatureManagementProviderTestWithContext.cs b/test/OpenFeature.Contrib.Providers.FeatureManagement.Test/FeatureManagementProviderTestWithContext.cs
index 28979253..3ab93a8a 100644
--- a/test/OpenFeature.Contrib.Providers.FeatureManagement.Test/FeatureManagementProviderTestWithContext.cs
+++ b/test/OpenFeature.Contrib.Providers.FeatureManagement.Test/FeatureManagementProviderTestWithContext.cs
@@ -38,7 +38,7 @@ public async Task MissingFlagKey_ShouldReturnDefault(bool defaultValue)
var provider = new FeatureManagementProvider(configuration);
// Act
- var result = await provider.ResolveBooleanValue("MissingFlagKey", defaultValue, evaluationContext);
+ var result = await provider.ResolveBooleanValueAsync("MissingFlagKey", defaultValue, evaluationContext);
// Assert
Assert.Equal(defaultValue, result.Value);
@@ -57,7 +57,7 @@ public async Task BooleanValue_ShouldReturnExpected(string key, string userId, s
var provider = new FeatureManagementProvider(configuration);
// Act
- var result = await provider.ResolveBooleanValue(key, defaultValue, evaluationContext);
+ var result = await provider.ResolveBooleanValueAsync(key, defaultValue, evaluationContext);
// Assert
Assert.Equal(expectedValue, result.Value);
@@ -76,7 +76,7 @@ public async Task DoubleValue_ShouldReturnExpected(string key, string userId, st
// Act
// Using 0.0 for the default to verify the value is being read from the configuration
- var result = await provider.ResolveDoubleValue(key, defaultValue, evaluationContext);
+ var result = await provider.ResolveDoubleValueAsync(key, defaultValue, evaluationContext);
// Assert
Assert.Equal(expectedValue, result.Value);
@@ -95,7 +95,7 @@ public async Task IntegerValue_ShouldReturnExpected(string key, string userId, s
// Act
// Using 0 for the default to verify the value is being read from the configuration
- var result = await provider.ResolveIntegerValue(key, defaultValue, evaluationContext);
+ var result = await provider.ResolveIntegerValueAsync(key, defaultValue, evaluationContext);
// Assert
Assert.Equal(expectedValue, result.Value);
@@ -114,7 +114,7 @@ public async Task StringValue_ShouldReturnExpected(string key, string userId, st
// Act
// Using 0 for the default to verify the value is being read from the configuration
- var result = await provider.ResolveStringValue(key, defaultValue, evaluationContext);
+ var result = await provider.ResolveStringValueAsync(key, defaultValue, evaluationContext);
// Assert
Assert.Equal(expectedValue, result.Value);
@@ -132,7 +132,7 @@ public async Task StructureValue_ShouldReturnExpected(string key, string userId,
var provider = new FeatureManagementProvider(configuration);
// Act
- var result = await provider.ResolveStructureValue(key, null, evaluationContext);
+ var result = await provider.ResolveStructureValueAsync(key, null, evaluationContext);
// Assert
Assert.NotNull(result);
@@ -153,7 +153,7 @@ public async Task StructureValue_ShouldReturnNull(string key, string userId, str
var provider = new FeatureManagementProvider(configuration);
// Act
- var result = await provider.ResolveStructureValue(key, null, evaluationContext);
+ var result = await provider.ResolveStructureValueAsync(key, null, evaluationContext);
// Assert
Assert.NotNull(result);
diff --git a/test/OpenFeature.Contrib.Providers.Flagd.E2e.Test/Steps/EvaluationStepDefinitionBase.cs b/test/OpenFeature.Contrib.Providers.Flagd.E2e.Test/Steps/EvaluationStepDefinitionBase.cs
index 8762c932..f14f67dc 100644
--- a/test/OpenFeature.Contrib.Providers.Flagd.E2e.Test/Steps/EvaluationStepDefinitionBase.cs
+++ b/test/OpenFeature.Contrib.Providers.Flagd.E2e.Test/Steps/EvaluationStepDefinitionBase.cs
@@ -51,7 +51,7 @@ public void Givenaproviderisregistered()
[When(@"a boolean flag with key ""(.*)"" is evaluated with default value ""(.*)""")]
public void Whenabooleanflagwithkeyisevaluatedwithdefaultvalue(string flagKey, bool defaultValue)
{
- this.booleanFlagValue = client.GetBooleanValue(flagKey, defaultValue);
+ this.booleanFlagValue = client.GetBooleanValueAsync(flagKey, defaultValue);
}
[Then(@"the resolved boolean value should be ""(.*)""")]
@@ -63,7 +63,7 @@ public void Thentheresolvedbooleanvalueshouldbe(bool expectedValue)
[When(@"a string flag with key ""(.*)"" is evaluated with default value ""(.*)""")]
public void Whenastringflagwithkeyisevaluatedwithdefaultvalue(string flagKey, string defaultValue)
{
- this.stringFlagValue = client.GetStringValue(flagKey, defaultValue);
+ this.stringFlagValue = client.GetStringValueAsync(flagKey, defaultValue);
}
[Then(@"the resolved string value should be ""(.*)""")]
@@ -75,7 +75,7 @@ public void Thentheresolvedstringvalueshouldbe(string expected)
[When(@"an integer flag with key ""(.*)"" is evaluated with default value (.*)")]
public void Whenanintegerflagwithkeyisevaluatedwithdefaultvalue(string flagKey, int defaultValue)
{
- this.intFlagValue = client.GetIntegerValue(flagKey, defaultValue);
+ this.intFlagValue = client.GetIntegerValueAsync(flagKey, defaultValue);
}
[Then(@"the resolved integer value should be (.*)")]
@@ -87,7 +87,7 @@ public void Thentheresolvedintegervalueshouldbe(int expected)
[When(@"a float flag with key ""(.*)"" is evaluated with default value (.*)")]
public void Whenafloatflagwithkeyisevaluatedwithdefaultvalue(string flagKey, double defaultValue)
{
- this.doubleFlagValue = client.GetDoubleValue(flagKey, defaultValue);
+ this.doubleFlagValue = client.GetDoubleValueAsync(flagKey, defaultValue);
}
[Then(@"the resolved float value should be (.*)")]
@@ -99,7 +99,7 @@ public void Thentheresolvedfloatvalueshouldbe(double expected)
[When(@"an object flag with key ""(.*)"" is evaluated with a null default value")]
public void Whenanobjectflagwithkeyisevaluatedwithanulldefaultvalue(string flagKey)
{
- this.objectFlagValue = client.GetObjectValue(flagKey, new Value());
+ this.objectFlagValue = client.GetObjectValueAsync(flagKey, new Value());
}
[Then(@"the resolved object value should be contain fields ""(.*)"", ""(.*)"", and ""(.*)"", with values ""(.*)"", ""(.*)"" and (.*), respectively")]
@@ -114,7 +114,7 @@ public void Thentheresolvedobjectvalueshouldbecontainfieldsandwithvaluesandrespe
[When(@"a boolean flag with key ""(.*)"" is evaluated with details and default value ""(.*)""")]
public void Whenabooleanflagwithkeyisevaluatedwithdetailsanddefaultvalue(string flagKey, bool defaultValue)
{
- this.booleanFlagDetails = client.GetBooleanDetails(flagKey, defaultValue);
+ this.booleanFlagDetails = client.GetBooleanDetailsAsync(flagKey, defaultValue);
}
[Then(@"the resolved boolean details value should be ""(.*)"", the variant should be ""(.*)"", and the reason should be ""(.*)""")]
@@ -129,7 +129,7 @@ public void Thentheresolvedbooleandetailsvalueshouldbethevariantshouldbeandthere
[When(@"a string flag with key ""(.*)"" is evaluated with details and default value ""(.*)""")]
public void Whenastringflagwithkeyisevaluatedwithdetailsanddefaultvalue(string flagKey, string defaultValue)
{
- this.stringFlagDetails = client.GetStringDetails(flagKey, defaultValue);
+ this.stringFlagDetails = client.GetStringDetailsAsync(flagKey, defaultValue);
}
[Then(@"the resolved string details value should be ""(.*)"", the variant should be ""(.*)"", and the reason should be ""(.*)""")]
@@ -144,7 +144,7 @@ public void Thentheresolvedstringdetailsvalueshouldbethevariantshouldbeandtherea
[When(@"an integer flag with key ""(.*)"" is evaluated with details and default value (.*)")]
public void Whenanintegerflagwithkeyisevaluatedwithdetailsanddefaultvalue(string flagKey, int defaultValue)
{
- this.intFlagDetails = client.GetIntegerDetails(flagKey, defaultValue);
+ this.intFlagDetails = client.GetIntegerDetailsAsync(flagKey, defaultValue);
}
[Then(@"the resolved integer details value should be (.*), the variant should be ""(.*)"", and the reason should be ""(.*)""")]
@@ -159,7 +159,7 @@ public void Thentheresolvedintegerdetailsvalueshouldbethevariantshouldbeandthere
[When(@"a float flag with key ""(.*)"" is evaluated with details and default value (.*)")]
public void Whenafloatflagwithkeyisevaluatedwithdetailsanddefaultvalue(string flagKey, double defaultValue)
{
- this.doubleFlagDetails = client.GetDoubleDetails(flagKey, defaultValue);
+ this.doubleFlagDetails = client.GetDoubleDetailsAsync(flagKey, defaultValue);
}
[Then(@"the resolved float details value should be (.*), the variant should be ""(.*)"", and the reason should be ""(.*)""")]
@@ -174,7 +174,7 @@ public void Thentheresolvedfloatdetailsvalueshouldbethevariantshouldbeandthereas
[When(@"an object flag with key ""(.*)"" is evaluated with details and a null default value")]
public void Whenanobjectflagwithkeyisevaluatedwithdetailsandanulldefaultvalue(string flagKey)
{
- this.objectFlagDetails = client.GetObjectDetails(flagKey, new Value());
+ this.objectFlagDetails = client.GetObjectDetailsAsync(flagKey, new Value());
}
[Then(@"the resolved object details value should be contain fields ""(.*)"", ""(.*)"", and ""(.*)"", with values ""(.*)"", ""(.*)"" and (.*), respectively")]
@@ -210,7 +210,7 @@ public void Givenaflagwithkeyisevaluatedwithdefaultvalue(string flagKey, string
{
contextAwareFlagKey = flagKey;
contextAwareDefaultValue = defaultValue;
- contextAwareValue = client.GetStringValue(flagKey, contextAwareDefaultValue, context).Result;
+ contextAwareValue = client.GetStringValueAsync(flagKey, contextAwareDefaultValue, context).Result;
}
[Then(@"the resolved string response should be ""(.*)""")]
@@ -222,7 +222,7 @@ public void Thentheresolvedstringresponseshouldbe(string expected)
[Then(@"the resolved flag value is ""(.*)"" when the context is empty")]
public void Giventheresolvedflagvalueiswhenthecontextisempty(string expected)
{
- string emptyContextValue = client.GetStringValue(contextAwareFlagKey, contextAwareDefaultValue, EvaluationContext.Empty).Result;
+ string emptyContextValue = client.GetStringValueAsync(contextAwareFlagKey, contextAwareDefaultValue, EvaluationContext.Empty).Result;
Assert.Equal(expected, emptyContextValue);
}
@@ -231,7 +231,7 @@ public void Whenanonexistentstringflagwithkeyisevaluatedwithdetailsandadefaultva
{
this.notFoundFlagKey = flagKey;
this.notFoundDefaultValue = defaultValue;
- this.notFoundDetails = client.GetStringDetails(this.notFoundFlagKey, this.notFoundDefaultValue).Result;
+ this.notFoundDetails = client.GetStringDetailsAsync(this.notFoundFlagKey, this.notFoundDefaultValue).Result;
}
[Then(@"the default string value should be returned")]
@@ -252,7 +252,7 @@ public void Whenastringflagwithkeyisevaluatedasanintegerwithdetailsandadefaultva
{
this.typeErrorFlagKey = flagKey;
this.typeErrorDefaultValue = defaultValue;
- this.typeErrorDetails = client.GetIntegerDetails(this.typeErrorFlagKey, this.typeErrorDefaultValue).Result;
+ this.typeErrorDetails = client.GetIntegerDetailsAsync(this.typeErrorFlagKey, this.typeErrorDefaultValue).Result;
}
[Then(@"the default integer value should be returned")]
diff --git a/test/OpenFeature.Contrib.Providers.Flagd.E2e.Test/Steps/FlagdStepDefinitionBase.cs b/test/OpenFeature.Contrib.Providers.Flagd.E2e.Test/Steps/FlagdStepDefinitionBase.cs
index 87e56c43..5d9c3ddd 100644
--- a/test/OpenFeature.Contrib.Providers.Flagd.E2e.Test/Steps/FlagdStepDefinitionBase.cs
+++ b/test/OpenFeature.Contrib.Providers.Flagd.E2e.Test/Steps/FlagdStepDefinitionBase.cs
@@ -90,7 +90,7 @@ public void ThenTheEventDetailsMustIndicateWasAltered(string p0)
[When(@"a zero-value boolean flag with key ""(.*)"" is evaluated with default value ""(.*)""")]
public void WhenAZero_ValueBooleanFlagWithKeyIsEvaluatedWithDefaultValue(string flagKey, string defaultValueString)
{
- booleanZeroValue = client.GetBooleanValue(flagKey, bool.Parse(defaultValueString));
+ booleanZeroValue = client.GetBooleanValueAsync(flagKey, bool.Parse(defaultValueString));
}
[Then(@"the resolved boolean zero-value should be ""(.*)""")]
@@ -102,7 +102,7 @@ public async void ThenTheResolvedBooleanZero_ValueShouldBe(string expectedValue)
[When(@"a zero-value string flag with key ""(.*)"" is evaluated with default value ""(.*)""")]
public void WhenAZero_ValueStringFlagWithKeyIsEvaluatedWithDefaultValue(string flagKey, string defaultValueString)
{
- stringZeroValue = client.GetStringValue(flagKey, defaultValueString);
+ stringZeroValue = client.GetStringValueAsync(flagKey, defaultValueString);
}
[Then(@"the resolved string zero-value should be ""(.*)""")]
@@ -114,7 +114,7 @@ public async Task ThenTheResolvedStringZero_ValueShouldBeAsync(string expectedVa
[When(@"a zero-value integer flag with key ""(.*)"" is evaluated with default value (.*)")]
public void WhenAZero_ValueIntegerFlagWithKeyIsEvaluatedWithDefaultValue(string flagKey, string defaultValueString)
{
- intZeroFlagValue = client.GetIntegerValue(flagKey, int.Parse(defaultValueString));
+ intZeroFlagValue = client.GetIntegerValueAsync(flagKey, int.Parse(defaultValueString));
}
[Then(@"the resolved integer zero-value should be (.*)")]
@@ -126,7 +126,7 @@ public async Task ThenTheResolvedIntegerZero_ValueShouldBeAsync(int expectedValu
[When(@"a zero-value float flag with key ""(.*)"" is evaluated with default value (.*)")]
public void WhenAZero_ValueFloatFlagWithKeyIsEvaluatedWithDefaultValue(string flagKey, decimal defaultValue)
{
- doubleZeroFlagValue = client.GetDoubleValue(flagKey, decimal.ToDouble(defaultValue));
+ doubleZeroFlagValue = client.GetDoubleValueAsync(flagKey, decimal.ToDouble(defaultValue));
}
[Then(@"the resolved float zero-value should be (.*)")]
@@ -185,21 +185,21 @@ public void WhenAContextContainingAKeyWithValue(string key, long val) // we have
[Then(@"the returned value should be ""(.*)""")]
public async void ThenTheReturnedValueShouldBe(string expectedValue)
{
- var details = await client.GetStringDetails(stringFlagKey, stringDefaultValue, evaluationContext);
+ var details = await client.GetStringDetailsAsync(stringFlagKey, stringDefaultValue, evaluationContext);
Assert.Equal(expectedValue, details.Value);
}
[Then(@"the returned value should be (.*)")]
public async Task ThenTheReturnedValueShouldBeAsync(long expectedValue)
{
- var details = await client.GetIntegerDetails(intFlagKey, intDefaultValue, evaluationContext);
+ var details = await client.GetIntegerDetailsAsync(intFlagKey, intDefaultValue, evaluationContext);
Assert.Equal(expectedValue, details.Value);
}
[Then(@"the returned reason should be ""(.*)""")]
public async Task ThenTheReturnedReasonShouldBeAsync(string expectedReason)
{
- var details = await client.GetStringDetails(stringFlagKey, stringDefaultValue, evaluationContext);
+ var details = await client.GetStringDetailsAsync(stringFlagKey, stringDefaultValue, evaluationContext);
Assert.Equal(expectedReason, details.Reason);
}
diff --git a/test/OpenFeature.Contrib.Providers.Flagd.Test/FlagdProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flagd.Test/FlagdProviderTest.cs
index e9b227af..2391dc42 100644
--- a/test/OpenFeature.Contrib.Providers.Flagd.Test/FlagdProviderTest.cs
+++ b/test/OpenFeature.Contrib.Providers.Flagd.Test/FlagdProviderTest.cs
@@ -179,7 +179,7 @@ public void TestGetProviderWithUri()
}
[Fact]
- public void TestResolveBooleanValue()
+ public void TestResolveBooleanValueAsync()
{
var resp = new ResolveBooleanResponse
{
@@ -203,7 +203,7 @@ public void TestResolveBooleanValue()
var flagdProvider = new FlagdProvider(rpcResolver);
// resolve with default set to false to make sure we return what the grpc server gives us
- var val = flagdProvider.ResolveBooleanValue("my-key", false);
+ var val = flagdProvider.ResolveBooleanValueAsync("my-key", false);
Assert.True(val.Result.Value);
}
@@ -229,7 +229,7 @@ public void TestResolveStringValue()
var rpcResolver = new RpcResolver(subGrpcClient, new FlagdConfig(), null, MakeChannel(), MakeProviderMetadata());
var flagdProvider = new FlagdProvider(rpcResolver);
- var val = flagdProvider.ResolveStringValue("my-key", "");
+ var val = flagdProvider.ResolveStringValueAsync("my-key", "");
Assert.Equal("my-value", val.Result.Value);
}
@@ -256,7 +256,7 @@ public void TestResolveIntegerValue()
var rpcResolver = new RpcResolver(subGrpcClient, new FlagdConfig(), null, MakeChannel(), MakeProviderMetadata());
var flagdProvider = new FlagdProvider(rpcResolver);
- var val = flagdProvider.ResolveIntegerValue("my-key", 0);
+ var val = flagdProvider.ResolveIntegerValueAsync("my-key", 0);
Assert.Equal(10, val.Result.Value);
}
@@ -283,7 +283,7 @@ public void TestResolveDoubleValue()
var rpcResolver = new RpcResolver(mockGrpcClient, new FlagdConfig(), null, MakeChannel(), MakeProviderMetadata());
var flagdProvider = new FlagdProvider(rpcResolver);
- var val = flagdProvider.ResolveDoubleValue("my-key", 0.0);
+ var val = flagdProvider.ResolveDoubleValueAsync("my-key", 0.0);
Assert.Equal(10.0, val.Result.Value);
}
@@ -313,7 +313,7 @@ public void TestResolveStructureValue()
var rpcResolver = new RpcResolver(mockGrpcClient, new FlagdConfig(), null, MakeChannel(), MakeProviderMetadata());
var flagdProvider = new FlagdProvider(rpcResolver);
- var val = flagdProvider.ResolveStructureValue("my-key", null);
+ var val = flagdProvider.ResolveStructureValueAsync("my-key", null);
Assert.True(val.Result.Value.AsStructure.ContainsKey("my-key"));
}
@@ -342,7 +342,7 @@ public void TestResolveFlagNotFound()
{
try
{
- await flagdProvider.ResolveBooleanValue("my-key", true);
+ await flagdProvider.ResolveBooleanValueAsync("my-key", true);
}
catch (FeatureProviderException e)
{
@@ -378,7 +378,7 @@ public void TestResolveGrpcHostUnavailable()
{
try
{
- await flagdProvider.ResolveBooleanValue("my-key", true);
+ await flagdProvider.ResolveBooleanValueAsync("my-key", true);
}
catch (FeatureProviderException e)
{
@@ -414,7 +414,7 @@ public void TestResolveTypeMismatch()
{
try
{
- await flagdProvider.ResolveBooleanValue("my-key", true);
+ await flagdProvider.ResolveBooleanValueAsync("my-key", true);
}
catch (FeatureProviderException e)
{
@@ -450,7 +450,7 @@ public void TestResolveUnknownError()
{
try
{
- await flagdProvider.ResolveBooleanValue("my-key", true);
+ await flagdProvider.ResolveBooleanValueAsync("my-key", true);
}
catch (FeatureProviderException e)
{
@@ -526,10 +526,10 @@ public async Task TestCacheAsync()
var rpcResolver = new RpcResolver(mockGrpcClient, config, mockCache, MakeChannel(), MakeProviderMetadata());
var flagdProvider = new FlagdProvider(rpcResolver);
- await flagdProvider.Initialize(EvaluationContext.Empty);
+ await flagdProvider.InitializeAsync(EvaluationContext.Empty);
// resolve with default set to false to make sure we return what the grpc server gives us
- var val = flagdProvider.ResolveBooleanValue("my-key", false);
+ var val = flagdProvider.ResolveBooleanValueAsync("my-key", false);
Assert.True(val.Result.Value);
Assert.True(_autoResetEvent.WaitOne(10000));
@@ -538,28 +538,6 @@ public async Task TestCacheAsync()
mockGrpcClient.Received(Quantity.AtLeastOne()).EventStream(Arg.Any(), null, null, CancellationToken.None);
}
- [Fact]
- public async Task TestResolverInit_Success_Ready()
- {
- var mockResolver = Substitute.For();
- mockResolver.Init().Returns(Task.CompletedTask);
- var provider = new FlagdProvider(resolver: mockResolver);
- await provider.Initialize(EvaluationContext.Empty);
-
- Assert.Equal(ProviderStatus.Ready, provider.GetStatus());
- }
-
- [Fact]
- public async Task TestResolverInit_Failure_Error()
- {
- var mockResolver = Substitute.For();
- mockResolver.Init().ThrowsAsync(new Exception("fake exception"));
- var provider = new FlagdProvider(resolver: mockResolver);
- await Assert.ThrowsAsync(() => provider.Initialize(EvaluationContext.Empty));
-
- Assert.Equal(ProviderStatus.Error, provider.GetStatus());
- }
-
[Fact]
public async Task TestCacheHitAsync()
{
@@ -612,10 +590,10 @@ public async Task TestCacheHitAsync()
var rpcResolver = new RpcResolver(mockGrpcClient, config, mockCache, MakeChannel(), MakeProviderMetadata());
var flagdProvider = new FlagdProvider(rpcResolver);
- await flagdProvider.Initialize(EvaluationContext.Empty);
+ await flagdProvider.InitializeAsync(EvaluationContext.Empty);
// resolve with default set to false to make sure we return what the grpc server gives us
- var val = flagdProvider.ResolveBooleanValue("my-key", false);
+ var val = flagdProvider.ResolveBooleanValueAsync("my-key", false);
Assert.True(val.Result.Value);
// wait for the autoReset event to be fired before verifying the invocation of the mocked functions
@@ -708,16 +686,16 @@ public async Task TestCacheInvalidationAsync()
var rpcResolver = new RpcResolver(mockGrpcClient, config, mockCache, MakeChannel(), MakeProviderMetadata());
var flagdProvider = new FlagdProvider(rpcResolver);
- await flagdProvider.Initialize(EvaluationContext.Empty);
+ await flagdProvider.InitializeAsync(EvaluationContext.Empty);
// resolve with default set to false to make sure we return what the grpc server gives us
- var val = flagdProvider.ResolveBooleanValue("my-key", false);
+ var val = flagdProvider.ResolveBooleanValueAsync("my-key", false);
Assert.True(val.Result.Value);
// set firstCall to true to make the mock EventStream return a configuration_change event
firstCall = false;
- val = flagdProvider.ResolveBooleanValue("my-key", false);
+ val = flagdProvider.ResolveBooleanValueAsync("my-key", false);
Assert.True(val.Result.Value);
Assert.True(_autoResetEvent.WaitOne(10000));
@@ -773,13 +751,13 @@ public async Task TestInProcessResolver()
var rpcResolver = new InProcessResolver(mockGrpcClient, config, MakeChannel(), MakeProviderMetadata());
var flagdProvider = new FlagdProvider(rpcResolver);
- await flagdProvider.Initialize(EvaluationContext.Empty);
+ await flagdProvider.InitializeAsync(EvaluationContext.Empty);
// resolve with default set to false to make sure we return what the grpc server gives us
await Utils.AssertUntilAsync(
_ =>
{
- var val = flagdProvider.ResolveBooleanValue("staticBoolFlag", false);
+ var val = flagdProvider.ResolveBooleanValueAsync("staticBoolFlag", false);
Assert.True(val.Result.Value);
});
@@ -831,13 +809,13 @@ public async Task TestInProcessResolverDefaultValueIfNotFound()
var inProcessResolver = new InProcessResolver(mockGrpcClient, config, MakeChannel(), MakeProviderMetadata());
var flagdProvider = new FlagdProvider(inProcessResolver);
- await flagdProvider.Initialize(EvaluationContext.Empty);
+ await flagdProvider.InitializeAsync(EvaluationContext.Empty);
// resolve with default set to false to make sure we return what the grpc server gives us
await Utils.AssertUntilAsync(
_ =>
{
- Assert.ThrowsAsync(() => flagdProvider.ResolveStringValue("unknown", "unknown"));
+ Assert.ThrowsAsync(() => flagdProvider.ResolveStringValueAsync("unknown", "unknown"));
});
mockGrpcClient.Received(Quantity.AtLeastOne()).SyncFlags(Arg.Is(req => req.Selector == "source-selector"), null, null, CancellationToken.None);
diff --git a/test/OpenFeature.Contrib.Providers.Flagd.Test/JsonEvaluatorTest.cs b/test/OpenFeature.Contrib.Providers.Flagd.Test/JsonEvaluatorTest.cs
index 6a83a977..930250a2 100644
--- a/test/OpenFeature.Contrib.Providers.Flagd.Test/JsonEvaluatorTest.cs
+++ b/test/OpenFeature.Contrib.Providers.Flagd.Test/JsonEvaluatorTest.cs
@@ -20,7 +20,7 @@ public void TestJsonEvaluatorAddFlagConfig()
jsonEvaluator.Sync(FlagConfigurationUpdateType.ADD, Utils.validFlagConfig);
- var result = jsonEvaluator.ResolveBooleanValue("validFlag", false);
+ var result = jsonEvaluator.ResolveBooleanValueAsync("validFlag", false);
Assert.True(result.Value);
@@ -35,7 +35,7 @@ public void TestJsonEvaluatorAddStaticStringEvaluation()
jsonEvaluator.Sync(FlagConfigurationUpdateType.ALL, Utils.flags);
- var result = jsonEvaluator.ResolveStringValue("staticStringFlag", "");
+ var result = jsonEvaluator.ResolveStringValueAsync("staticStringFlag", "");
Assert.Equal("#CC0000", result.Value);
Assert.Equal("red", result.Variant);
@@ -59,7 +59,7 @@ public void TestJsonEvaluatorDynamicBoolEvaluation()
builder
.Set("color", "yellow");
- var result = jsonEvaluator.ResolveBooleanValue("targetingBoolFlag", false, builder.Build());
+ var result = jsonEvaluator.ResolveBooleanValueAsync("targetingBoolFlag", false, builder.Build());
Assert.True(result.Value);
Assert.Equal("bool1", result.Variant);
@@ -80,7 +80,7 @@ public void TestJsonEvaluatorDynamicBoolEvaluationUsingFlagdPropertyFlagKey()
var builder = EvaluationContext.Builder();
- var result = jsonEvaluator.ResolveBooleanValue("targetingBoolFlagUsingFlagdProperty", false, builder.Build());
+ var result = jsonEvaluator.ResolveBooleanValueAsync("targetingBoolFlagUsingFlagdProperty", false, builder.Build());
Assert.True(result.Value);
Assert.Equal("bool1", result.Variant);
@@ -101,7 +101,7 @@ public void TestJsonEvaluatorDynamicBoolEvaluationUsingFlagdPropertyTimestamp()
var builder = EvaluationContext.Builder();
- var result = jsonEvaluator.ResolveBooleanValue("targetingBoolFlagUsingFlagdPropertyTimestamp", false, builder.Build());
+ var result = jsonEvaluator.ResolveBooleanValueAsync("targetingBoolFlagUsingFlagdPropertyTimestamp", false, builder.Build());
Assert.True(result.Value);
Assert.Equal("bool1", result.Variant);
@@ -119,7 +119,7 @@ public void TestJsonEvaluatorDynamicBoolEvaluationSharedEvaluator()
var builder = EvaluationContext.Builder().Set("email", "test@faas.com");
- var result = jsonEvaluator.ResolveBooleanValue("targetingBoolFlagUsingSharedEvaluator", false, builder.Build());
+ var result = jsonEvaluator.ResolveBooleanValueAsync("targetingBoolFlagUsingSharedEvaluator", false, builder.Build());
Assert.True(result.Value);
Assert.Equal("bool1", result.Variant);
@@ -137,7 +137,7 @@ public void TestJsonEvaluatorDynamicBoolEvaluationSharedEvaluatorReturningBoolTy
var builder = EvaluationContext.Builder().Set("email", "test@faas.com");
- var result = jsonEvaluator.ResolveBooleanValue("targetingBoolFlagUsingSharedEvaluatorReturningBoolType", false, builder.Build());
+ var result = jsonEvaluator.ResolveBooleanValueAsync("targetingBoolFlagUsingSharedEvaluatorReturningBoolType", false, builder.Build());
Assert.True(result.Value);
Assert.Equal("true", result.Variant);
@@ -155,7 +155,7 @@ public void TestJsonEvaluatorDynamicBoolEvaluationWithMissingDefaultVariant()
var builder = EvaluationContext.Builder();
- Assert.Throws(() => jsonEvaluator.ResolveBooleanValue("targetingBoolFlagWithMissingDefaultVariant", false, builder.Build()));
+ Assert.Throws(() => jsonEvaluator.ResolveBooleanValueAsync("targetingBoolFlagWithMissingDefaultVariant", false, builder.Build()));
}
[Fact]
@@ -169,7 +169,7 @@ public void TestJsonEvaluatorDynamicBoolEvaluationWithUnexpectedVariantType()
var builder = EvaluationContext.Builder();
- Assert.Throws(() => jsonEvaluator.ResolveBooleanValue("targetingBoolFlagWithUnexpectedVariantType", false, builder.Build()));
+ Assert.Throws(() => jsonEvaluator.ResolveBooleanValueAsync("targetingBoolFlagWithUnexpectedVariantType", false, builder.Build()));
}
[Fact]
@@ -188,7 +188,7 @@ public void TestJsonEvaluatorDynamicStringEvaluation()
builder
.Set("color", "yellow");
- var result = jsonEvaluator.ResolveStringValue("targetingStringFlag", "", builder.Build());
+ var result = jsonEvaluator.ResolveStringValueAsync("targetingStringFlag", "", builder.Build());
Assert.Equal("my-string", result.Value);
Assert.Equal("str1", result.Variant);
@@ -211,7 +211,7 @@ public void TestJsonEvaluatorDynamicFloatEvaluation()
builder
.Set("color", "yellow");
- var result = jsonEvaluator.ResolveDoubleValue("targetingFloatFlag", 0, builder.Build());
+ var result = jsonEvaluator.ResolveDoubleValueAsync("targetingFloatFlag", 0, builder.Build());
Assert.Equal(100, result.Value);
Assert.Equal("number1", result.Variant);
@@ -234,7 +234,7 @@ public void TestJsonEvaluatorDynamicIntEvaluation()
builder
.Set("color", "yellow");
- var result = jsonEvaluator.ResolveIntegerValue("targetingNumberFlag", 0, builder.Build());
+ var result = jsonEvaluator.ResolveIntegerValueAsync("targetingNumberFlag", 0, builder.Build());
Assert.Equal(100, result.Value);
Assert.Equal("number1", result.Variant);
@@ -257,7 +257,7 @@ public void TestJsonEvaluatorDynamicObjectEvaluation()
builder
.Set("color", "yellow");
- var result = jsonEvaluator.ResolveStructureValue("targetingObjectFlag", null, builder.Build());
+ var result = jsonEvaluator.ResolveStructureValueAsync("targetingObjectFlag", null, builder.Build());
Assert.True(result.Value.AsStructure.AsDictionary()["key"].AsBoolean);
Assert.Equal("object1", result.Variant);
@@ -280,7 +280,7 @@ public void TestJsonEvaluatorDisabledBoolEvaluation()
builder
.Set("color", "yellow");
- Assert.Throws(() => jsonEvaluator.ResolveBooleanValue("disabledFlag", false, builder.Build()));
+ Assert.Throws(() => jsonEvaluator.ResolveBooleanValueAsync("disabledFlag", false, builder.Build()));
}
[Fact]
@@ -299,7 +299,7 @@ public void TestJsonEvaluatorFlagNotFoundEvaluation()
builder
.Set("color", "yellow");
- Assert.Throws(() => jsonEvaluator.ResolveBooleanValue("missingFlag", false, builder.Build()));
+ Assert.Throws(() => jsonEvaluator.ResolveBooleanValueAsync("missingFlag", false, builder.Build()));
}
[Fact]
@@ -318,7 +318,7 @@ public void TestJsonEvaluatorWrongTypeEvaluation()
builder
.Set("color", "yellow");
- Assert.Throws(() => jsonEvaluator.ResolveBooleanValue("staticStringFlag", false, builder.Build()));
+ Assert.Throws(() => jsonEvaluator.ResolveBooleanValueAsync("staticStringFlag", false, builder.Build()));
}
}
}
diff --git a/test/OpenFeature.Contrib.Providers.Flagsmith.Test/FlagsmithProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flagsmith.Test/FlagsmithProviderTest.cs
index a16558d6..f11ae250 100644
--- a/test/OpenFeature.Contrib.Providers.Flagsmith.Test/FlagsmithProviderTest.cs
+++ b/test/OpenFeature.Contrib.Providers.Flagsmith.Test/FlagsmithProviderTest.cs
@@ -65,7 +65,7 @@ public async Task GetValue_ForEnabledFeatureWithEvaluationContext_ReturnCorrectV
var date = DateTime.Now;
flags.GetFeatureValue("example-feature").Returns("true");
flags.IsFeatureEnabled("example-feature").Returns(true);
- flagsmithClient.GetIdentityFlags("233", Arg.Is>(x => x.Count == 6 && x.Any(c => c.GetTraitKey() == "key1"))).Returns(flags);
+ flagsmithClient.GetIdentityFlags("233", Arg.Is>(x => x.Count > 6 && x.Any(c => c.GetTraitKey() == "key1"))).Returns(flags);
var providerConfig = GetDefaultFlagsmithProviderConfigurationConfiguration();
var flagsmithProvider = new FlagsmithProvider(providerConfig, flagsmithClient);
@@ -79,7 +79,7 @@ public async Task GetValue_ForEnabledFeatureWithEvaluationContext_ReturnCorrectV
.Set("key6", 1.0)
.SetTargetingKey("233");
// Act
- var result = await flagsmithProvider.ResolveBooleanValue("example-feature", false, contextBuilder.Build());
+ var result = await flagsmithProvider.ResolveBooleanValueAsync("example-feature", false, contextBuilder.Build());
// Assert
Assert.True(result.Value);
@@ -107,7 +107,7 @@ public async Task GetValue_ForEnabledFeatureWithEvaluationContext_ReturnCorrectV
[InlineData(false, true, "false", false, "DISABLED", false)]
[InlineData(true, false, "false", false, null, false)]
[InlineData(false, false, "false", false, null, false)]
- public async Task GetBooleanValue_ForEnabledFeatureWithValidFormatAndSettedConfigValue_ReturnExpectedResult(
+ public async Task GetBooleanValueAsync_ForEnabledFeatureWithValidFormatAndSettedConfigValue_ReturnExpectedResult(
bool defaultValue,
bool enabledValueConfig,
string settedValue,
@@ -127,7 +127,7 @@ public async Task GetBooleanValue_ForEnabledFeatureWithValidFormatAndSettedConfi
var flagsmithProvider = new FlagsmithProvider(providerConfig, flagsmithClient);
// Act
- var result = await flagsmithProvider.ResolveBooleanValue("example-feature", defaultValue);
+ var result = await flagsmithProvider.ResolveBooleanValueAsync("example-feature", defaultValue);
// Assert
Assert.Equal(expectedResult, result.Value);
@@ -137,7 +137,7 @@ public async Task GetBooleanValue_ForEnabledFeatureWithValidFormatAndSettedConfi
}
[Fact]
- public async Task GetBooleanValue_ForEnabledFeatureWithWrongFormatValue_ThrowsTypeMismatch()
+ public async Task GetBooleanValueAsync_ForEnabledFeatureWithWrongFormatValue_ThrowsTypeMismatch()
{
// Arrange
var flagsmithClient = Substitute.For();
@@ -152,12 +152,12 @@ public async Task GetBooleanValue_ForEnabledFeatureWithWrongFormatValue_ThrowsTy
var flagsmithProvider = new FlagsmithProvider(providerConfig, flagsmithClient);
// Act and Assert
- await Assert.ThrowsAsync(() => flagsmithProvider.ResolveBooleanValue("example-feature", true));
+ await Assert.ThrowsAsync(() => flagsmithProvider.ResolveBooleanValueAsync("example-feature", true));
}
[Fact]
- public async Task GetDoubleValue_ForEnabledFeatureWithValidFormat_ReturnCorrectValue()
+ public async Task GetDoubleValueAsync_ForEnabledFeatureWithValidFormat_ReturnCorrectValue()
{
// Arrange
var flagsmithClient = Substitute.For();
@@ -171,7 +171,7 @@ public async Task GetDoubleValue_ForEnabledFeatureWithValidFormat_ReturnCorrectV
var flagsmithProvider = new FlagsmithProvider(providerConfig, flagsmithClient);
// Act
- var result = await flagsmithProvider.ResolveDoubleValue("example-feature", 32.22);
+ var result = await flagsmithProvider.ResolveDoubleValueAsync("example-feature", 32.22);
// Assert
Assert.Equal(32.334, result.Value);
@@ -182,7 +182,7 @@ public async Task GetDoubleValue_ForEnabledFeatureWithValidFormat_ReturnCorrectV
[Fact]
- public async Task GetDoubleValue_ForDisabledFeatureWithValidFormat_ReturnDefaultValue()
+ public async Task GetDoubleValueAsync_ForDisabledFeatureWithValidFormat_ReturnDefaultValue()
{
// Arrange
var flagsmithClient = Substitute.For();
@@ -195,7 +195,7 @@ public async Task GetDoubleValue_ForDisabledFeatureWithValidFormat_ReturnDefault
var flagsmithProvider = new FlagsmithProvider(providerConfig, flagsmithClient);
// Act
- var result = await flagsmithProvider.ResolveDoubleValue("example-feature", -32.22);
+ var result = await flagsmithProvider.ResolveDoubleValueAsync("example-feature", -32.22);
// Assert
Assert.Equal(-32.22, result.Value);
@@ -205,7 +205,7 @@ public async Task GetDoubleValue_ForDisabledFeatureWithValidFormat_ReturnDefault
}
[Fact]
- public async Task GetDoubleValue_ForEnabledFeatureWithWrongFormatValue_ThrowsTypeMismatch()
+ public async Task GetDoubleValueAsync_ForEnabledFeatureWithWrongFormatValue_ThrowsTypeMismatch()
{
// Arrange
var flagsmithClient = Substitute.For();
@@ -218,13 +218,13 @@ public async Task GetDoubleValue_ForEnabledFeatureWithWrongFormatValue_ThrowsTyp
var flagsmithProvider = new FlagsmithProvider(providerConfig, flagsmithClient);
// Act and Assert
- await Assert.ThrowsAsync