From 25af4babf2e8b697f6e3229d20770fd911655cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <2493377+askpt@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:41:58 +0000 Subject: [PATCH] Adding specification test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com> --- .../OpenFeatureClientTests.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/OpenFeature.Tests/OpenFeatureClientTests.cs b/test/OpenFeature.Tests/OpenFeatureClientTests.cs index 13d3fa93..1cab2d76 100644 --- a/test/OpenFeature.Tests/OpenFeatureClientTests.cs +++ b/test/OpenFeature.Tests/OpenFeatureClientTests.cs @@ -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(); + 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>(), evaluationDetails); + } } }