Skip to content
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 statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OptimizelyUserContext should implement an interface for mockability #289

Closed
bruceparish opened this issue Dec 8, 2021 · 1 comment
Closed

Comments

@bruceparish
Copy link

Similar to how Optimizely implements IOptimizely, OptimizelyUserContext should also implement an interface so that consumers of your SDK can properly mock it for unit testing.

I think it would be a fairly small change.

  1. Add an IOptimizelyUserContext interface.
  2. Implement that interface in the OptimizelyUserContext class.
  3. Update OptimizelyUserContext constructor to accept an IOptimizely instance instead of an Optimizely instance.
  4. Update the CreateUserContext method signature to return this new interface rather than the actual type.

All actual implementations remain the same.

@dustin-sier
Copy link
Contributor

Wanted to let you know that we've actually got a release coming out shortly that addresses just this.

Link to the pull request: #280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants