Following are the general concerns while writing unit Test Case, they are

How to initialize UserIdentity (TenantId, UserId) from Unit Test in the following scenarios

  • Calling WCF service
  • Calling Inproc service

Calling Inproc service

CelloSaaS application uses the form identity provider to fill the user identity details, but when writing Unit Test case for the Windows service project we can’t use the form identity provider because it will always run under the context of single user (Product/ Tenant admin). Hence, we need to use the CustomIdentityProvider that inherits from the CelloSaaS.Library.IUserIdentityProvider.

Refer the TestUserIdentity.cs file for reference.

Change the TestUserIdentity assembly and its type in App.Config file also.


<IdentityProvider defaultProvider="Default">


<add name="Default" assembly="CelloSaaS.Services.Tests" type="CelloSaaS.Services.Tests.TestUserIdentity"/>




Calling WCF service


  • Need to add test user identity and Service Helper when we use test cases for WCF projects.
  • For every service call we required the authentication information (User Name and Password) to pass.
  • To send this information we use custom service helper so that no need to pass the information manually every time.
  • Please find the attached ServiceHelper.cs file for reference.
  • Call the WCF service using this service helper.

Note: For more details refer - Unit Test Case How to guide.