question

romesh avatar image
romesh asked

Anyone got a good way to stub PlayFabAllSDK api's for unit testing?

None of the api classes in the PlayFabAllSDK have interfaces or any overridable members, which makes it impossible to write tests for any code that depends on the API without making real API calls. This is a really bad practice for unit tests and I'd love to know if anyone has found any workarounds for writing unit tests around playfab sdk's?

sdks
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

PlayFab C# SDK provides the code for unit test, please refer to CSharpSDK/PlayFabSDK/source/Uunit/tests at master · PlayFab/CSharpSDK · GitHub. If you want to stub PlayFab C# SDK, you can use Sinon or other services to do the stub.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.