Mar 06 2017
06:51 PM
- last edited on
Jul 24 2020
02:49 AM
by
TechCommunityAP
Mar 06 2017
06:51 PM
- last edited on
Jul 24 2020
02:49 AM
by
TechCommunityAP
Hello
I'm trying to understand how I can create some unit tests against the MS graph API, or how to mock it
Raul
Mar 28 2017 03:05 PM
Aug 25 2017 04:07 PM - edited Aug 25 2017 04:08 PM
Any update on this? Will Microsoft ever provide a unit test framework for their API's and Office environments?
May 18 2018 03:49 PM
I was able to get an answer from the team (below). Hope this is helpful (and sorry for the delay).
While to give a full answer, we'd need to know what languages you cared about. the key thing is that it should be pretty easy.
In terms of mocking, just have one method that makes all graph calls and use dependency injection to substitute an arbitrary mock.
You can save the json responses of some real calls and have your mock return those. It should work fine with your favorite mock / DI framework or just make custom mocks.
You can look at the actual dot netsdk for graph for examples: https://github.com/microsoftgraph/msgraph-sdk-dotnet/tree/dev/tests/Microsoft.Graph.Core.Test/Mocks that uses Moq: https://github.com/moq/moq
May 20 2021 08:38 AM