forked from open-feature/dotnet-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContextMergingPrecedenceStepDefinitions.cs
More file actions
35 lines (28 loc) · 1.14 KB
/
Copy pathContextMergingPrecedenceStepDefinitions.cs
File metadata and controls
35 lines (28 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Threading.Tasks;
using OpenFeature.E2ETests.Utils;
using Reqnroll;
using Xunit;
namespace OpenFeature.E2ETests.Steps;
[Binding]
[Scope(Feature = "Context merging precedence")]
public class ContextMergingPrecedenceStepDefinitions : BaseStepDefinitions
{
public ContextMergingPrecedenceStepDefinitions(State state) : base(state)
{
}
[When("Some flag was evaluated")]
public async Task WhenSomeFlagWasEvaluated()
{
this.State.Flag = new FlagState("boolean-flag", "true", FlagType.Boolean);
this.State.FlagResult = await this.State.Client!.GetBooleanValueAsync("boolean-flag", true, this.State.InvocationEvaluationContext).ConfigureAwait(false);
}
[Then(@"The merged context contains an entry with key ""(.*)"" and value ""(.*)""")]
public void ThenTheMergedContextContainsAnEntryWithKeyAndValue(string key, string value)
{
var provider = this.State.ContextStoringProvider;
var mergedContext = provider!.EvaluationContext!;
Assert.NotNull(mergedContext);
var actualValue = mergedContext.GetValue(key);
Assert.Contains(value, actualValue.AsString);
}
}