diff --git a/global.json b/global.json index 9f8f3618..74eea28b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { "rollForward": "latestFeature", - "version": "8.0.303" + "version": "8.0.302" } } diff --git a/test/OpenFeature.Tests/OpenFeatureEvaluationContextTests.cs b/test/OpenFeature.Tests/OpenFeatureEvaluationContextTests.cs index 896b56e2..2f1f8fc4 100644 --- a/test/OpenFeature.Tests/OpenFeatureEvaluationContextTests.cs +++ b/test/OpenFeature.Tests/OpenFeatureEvaluationContextTests.cs @@ -171,12 +171,28 @@ public void TryGetValue_WhenCalledWithExistingKey_ReturnsTrueAndExpectedValue() } [Fact] - public void GetValueOnTargetingKey_Equals_TargetingKey() + public void GetValueOnTargetingKeySetWithStructure_Equals_TargetingKey() { // Arrange var value = "my_targeting_key"; - var structure = new Structure(new Dictionary { { EvaluationContext.TargetingKeyIndex, new Value(value) } }); - var evaluationContext = new EvaluationContext(structure); + var evaluationContext = EvaluationContext.Builder().Set(EvaluationContext.TargetingKeyIndex, new Value(value)).Build(); + + // Act + var result = evaluationContext.TryGetValue(EvaluationContext.TargetingKeyIndex, out var actualValue); + var targetingKeyvalue = evaluationContext.TargetingKey; + + // Assert + Assert.True(result); + Assert.Equal(value, actualValue?.AsString); + Assert.Equal(value, targetingKeyvalue); + } + + [Fact] + public void GetValueOnTargetingKeySetWithTargetingKey_Equals_TargetingKey() + { + // Arrange + var value = "my_targeting_key"; + var evaluationContext = EvaluationContext.Builder().SetTargetingKey(value).Build(); // Act var result = evaluationContext.TryGetValue(EvaluationContext.TargetingKeyIndex, out var actualValue);