Skip to content

Commit

Permalink
fixup: improve testing
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
  • Loading branch information
toddbaert committed Jul 26, 2024
1 parent 90e9633 commit fe6aa2a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"rollForward": "latestFeature",
"version": "8.0.303"
"version": "8.0.302"
}
}
22 changes: 19 additions & 3 deletions test/OpenFeature.Tests/OpenFeatureEvaluationContextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, Value> { { 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);
Expand Down

0 comments on commit fe6aa2a

Please sign in to comment.