Hi folks,
I am trying to use JustMock to mock a SharePoint collection (the real thing cannot be used as it fails without a SharePoint context). I cannot figure out how to add items the collection. Here is my code.
I would like to add the SPRoleDefinition instance called role to the SPRoleDefinitionBindingCollection. The uut.Add call is obviously being ignored, which is indicated by the fact that uut.Count is zero. I would expect this to work...
Can you help?
Thanks in advance and kr, Bernd.
I am trying to use JustMock to mock a SharePoint collection (the real thing cannot be used as it fails without a SharePoint context). I cannot figure out how to add items the collection. Here is my code.
var uut = Mock.Create<SPRoleDefinitionBindingCollection>(); var role = Mock.Create<SPRoleDefinition>();Mock.Arrange(() => role.BasePermissions) .Returns(SPBasePermissions.ViewUsageData | SPBasePermissions.EditListItems | SPBasePermissions.DeleteListItems);uut.Add(role);var result = uut.ContainsPermission(SPBasePermissions.DeleteListItems);Assert.IsTrue(result);I would like to add the SPRoleDefinition instance called role to the SPRoleDefinitionBindingCollection. The uut.Add call is obviously being ignored, which is indicated by the fact that uut.Count is zero. I would expect this to work...
Can you help?
Thanks in advance and kr, Bernd.