Am trying to create unit test for a SharePoint method but getting get_Web related error- TypeMock.TypeMockException :*** Method get_Web in type Microsoft.SharePoint.Client.ClientContext returns Microsoft.SharePoint.Client.Web and not Microsoft.SharePoint.Client.Web., PFB the unit test I have written. While debugging, it fails at assert.equal statement, it would be helpful if someone can point out where am getting wrong.
public static UsersFromGroupInfo GetAllInfo(string vendorName, string role, ClientContext clientContext)
[TestMethod]
[Isolated]
public void Test_To_Get_All_Info()
{
//Arrange
ClientContext context = Isolate.Fake.NextInstance<ClientContext>(); //fake the client context
List lstGroupMappingDetails = Isolate.Fake.Instance<List>(); //fake the list object
Isolate.WhenCalled(() => context.Web.Lists.GetByTitle("GroupMappingOfInfo")).WillReturn(lstGroupMappingDetails);
ListItem fakeListItem = Isolate.Fake.Instance<ListItem>();
Isolate.WhenCalled(() => fakeListItem["Title"]).WithExactArguments().WillReturn("Manager");
Isolate.WhenCalled(() => fakeListItem["Vendor"]).WithExactArguments().WillReturn("Dummy");
Isolate.WhenCalled(() => fakeListItem["GroupName"]).WithExactArguments().WillReturn("Grp_Mgr");
List<ListItem> listItems = new List<ListItem> { fakeListItem };
Isolate.WhenCalled(() => lstGroupMappingDetails.GetItems(null)).WillReturnCollectionValuesOf(listItems);
Isolate.WhenCalled(() => context.Load(lstGroupMappingDetails)).IgnoreCall(); //Ignore loading of context
Isolate.WhenCalled(() => context.ExecuteQuery()).IgnoreCall(); //Ignore execution of SPQuery
Group group = Isolate.Fake.Instance<Group>(); //fake the group object
Isolate.WhenCalled(() => context.Web.SiteGroups.GetByName("Grp_Mgr")).WillReturn(group);
Isolate.WhenCalled(() => context.Load(group)).IgnoreCall(); //Ignore loading of context
Isolate.WhenCalled(() => context.ExecuteQuery()).IgnoreCall();
Collection<string> groupUser = new Collection<string>();
groupUser.Add(fakeListItem["Title"].ToString());
//Assert
Assert.AreEqual(groupUser, PortalCommon.GetAllInfo("Manager", "Dummy", context));
}