Skip to content

OptimizelyUserContext should implement an interface for mockability #289

Closed
@bruceparish

Description

@bruceparish

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions