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

What is the best way to unit test bot which uses this AuthBot #22

Closed
kenakamu opened this issue May 22, 2017 · 2 comments
Closed

What is the best way to unit test bot which uses this AuthBot #22

kenakamu opened this issue May 22, 2017 · 2 comments

Comments

@kenakamu
Copy link

I am writing UnitTest and want to Mock AuthBot. But as it extends IDialogContext, I am not sure what is the best way to Mock the service.

@kenakamu
Copy link
Author

Which one you guys prefer?

  • Add option to let bypass GetToken extention methods
  • Add check logic if ServiceUri == "InvalidUri" to bypass auth method

@kenakamu
Copy link
Author

I decided to use Microsoft Fakes.

using (ShimsContext.Create())
{
    AuthBot.Fakes.ShimContextExtensions.GetAccessTokenIBotContextString = 
         async (c, r) => { return "dummyToken"; };
    // do the rest
}

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

No branches or pull requests

1 participant