Skip to content

Commit

Permalink
Adding specification test.
Browse files Browse the repository at this point in the history
Signed-off-by: André Silva <[email protected]>
  • Loading branch information
askpt committed Dec 20, 2024
1 parent 5cedb62 commit 25af4ba
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/OpenFeature.Tests/OpenFeatureClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -656,5 +656,25 @@ public async Task TheClient_MergesTheEvaluationContextInTheCorrectOrder(string k

Assert.Equal(expectedResult, actualEvaluationContext.GetValue(key).AsString);
}

[Fact]
[Specification("4.3.8", "'evaluation details' passed to the 'finally' stage matches the evaluation details returned to the application author")]
public async Task FinallyHook_IncludesEvaluationDetails()
{
// Arrange
var provider = new TestProvider();
var providerHook = Substitute.For<Hook>();
provider.AddHook(providerHook);
await Api.Instance.SetProviderAsync(provider);
var client = Api.Instance.GetClient();

const string flagName = "flagName";

// Act
var evaluationDetails = await client.GetBooleanDetailsAsync(flagName, true);

// Assert
await providerHook.Received(1).FinallyAsync(Arg.Any<HookContext<bool>>(), evaluationDetails);
}
}
}

0 comments on commit 25af4ba

Please sign in to comment.