8000 move validate forced decision to decision service by msohailhussain · Pull Request #292 · optimizely/csharp-sdk · GitHub
[go: up one dir, main page]

Skip to content

move validate forced decision to decision service #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statemen 8000 t. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 5, 2022

Conversation

msohailhussain
Copy link
Contributor
@msohailhussain msohailhussain commented Dec 21, 2021

Summary

  • Moves findValidatedForcedDecision method to decision service as validatedForcedDecision

Test plan

All unit test and FSC tests should pass.

/// <param name="context">Object containing flag and rule key of which forced decision is set.</param>
/// <param name="flagDecision">Object containing forced decision based on the provided context.</param>
/// <param name="config">The Project config.</param>
/// <returns>A result with the variation</returns>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to revise parameters.

Copy link
Contributor
@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good! A couple of suggestions you can consider.

/// <param name="flagDecision">Object containing forced decision based on the provided context.</param>
/// <param name="config">The Project config.</param>
/// <returns>A result with the variation</returns>
public Result<Variation> ValidatedForcedDecision(OptimizelyDecisionContext context, OptimizelyForcedDecision forcedDecision, ProjectConfig config, string userId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about passing userContext. This can be simpler and extensible with usercontext?

Suggested change
public Result<Variation> ValidatedForcedDecision(OptimizelyDecisionContext context, OptimizelyForcedDecision forcedDecision, ProjectConfig config, string userId)
public Result<Variation> ValidatedForcedDecision(OptimizelyDecisionContext context, OptimizelyUserContext user, ProjectConfig config)

@@ -289,16 +289,18 @@ public void TestGetForcedDecisionReturnsValueWithRuleKey()
[Test]
public void TestFindValidatedForcedDecisionReturnsCorrectDecisionWithNullVariation()
{
var decisionReasons = new DecisionReasons();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this test will be moved to DecisionService.

Copy link
Contributor
@dustin-sier dustin-sier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good. All of Jae's changes I agree with.

Copy link
Contributor
@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@msohailhussain msohailhussain merged commit 5a6a098 into master Jan 5, 2022
@msohailhussain msohailhussain deleted the sohail/validateforceddecisionmove branch January 5, 2022 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0