You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
Apologies for the delay in anyone responding to this issue. I guess by now that you've either found a solution or worked round the problem. If not, please ask a question on stackoverflow, tagging the question with one of the aad* or msgraph tags.
I assume you are referring to the Microsoft.Azure.ActiveDirectory.GraphClient library. The client object and user collection are both interfaces so you could provide your own implementations of these interfaces for test purposes. I'm not familiar with NSubstitute but the following code seems to create a dummy client and user collection:
// Create a dummy user collectionvarusers=Substitute.For<Microsoft.Azure.ActiveDirectory.GraphClient.IUserCollection>();varuserFetcher1=Substitute.For<Microsoft.Azure.ActiveDirectory.GraphClient.IUserFetcher>();users.GetByObjectId(null).ReturnsForAnyArgs(userFetcher1);// Create a dummy clientvarclient=Substitute.For<Microsoft.Azure.ActiveDirectory.GraphClient.IActiveDirectoryClient>();client.Users.Returns(users);// Get an item from the collectionvarobj=client.Users.GetByObjectId("123");
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I've been trying to UnitTest the SDK and using nsubstitute.
Have not found a way to return something i want out of the client.Users object.
The client.Users returns an IUserCollection object which I cannot create a fake object to return in the unit tests.
The text was updated successfully, but these errors were encountered: