I'm trying to create a mock version of UserProfileManager in order to effectively unit test a Sharepoint 2010 Web Part
Every time I run this code, I get the the exception being thrown below. I've verified that the feature works when I debug the code that calls UserProfileManager on the Sharepoint machine - two different Sharepoint machines, in fact.
Here is the code in question:
Unable to create instance of class SharePoint.MyWebPart.Test.MyTest. Error: Microsoft.SharePoint.SPException: The trial period for this product has expired..
at Microsoft.Office.Server.UserProfiles.ProfileManagerBase.ValidateLicensing()
at Microsoft.Office.Server.UserProfiles.ProfileManagerBase..ctor(SPServiceContext serviceContext)
at Microsoft.Office.Server.UserProfiles.ProfileManagerBase..ctor(SPServiceContext serviceContext, Boolean ignorePrivacy)
at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(SPServiceContext serviceContext, Boolean IgnoreUserPrivacy, Boolean backwardCompatible)
at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(SPServiceContext serviceContext)
at Castle.Proxies.UserProfileManagerProxy..ctor(IEventsMixin, IMockReplicator, IMockMixin, IInterceptor[], SPServiceContext)
at DynamicMethod_6f2d60ffa4f94cb4ba57556150461ef9(Object[])
at ...()
at ..[](Func`1 )
at ..(Type , Object[] )
at ..(Type , List`1 , Type , Object[] )
at ..(Type , Type[] , ProxyGenerationOptions , Object[] , IInterceptor[] )
at Telerik.JustMock.Core.MocksRepository.Create(Type , Object[] , IEnumerable`1 , IEnumerable`1 , IEnumerable`1 , Type[] , Boolean , Boolean , IEnumerable`1 )
at ..Create(MocksRepository , Type , Object[] , Nullable`1 , Type[] , Nullable`1 , IEnumerable`1 , List`1 , List`1 , List`1 )
at Telerik.JustMock.Mock..()
at ..[](Func`1 )
at Telerik.JustMock.Mock.Create(Object[] args)
Has anyone else seen this issuue?
Every time I run this code, I get the the exception being thrown below. I've verified that the feature works when I debug the code that calls UserProfileManager on the Sharepoint machine - two different Sharepoint machines, in fact.
Here is the code in question:
var _mockServiceContext = Mock.Create<SPServiceContext>();
var _mockUserProfileManager = Mock.Create<UserProfileManager>(
new
object
[] {_mockServiceContext});
Unable to create instance of class SharePoint.MyWebPart.Test.MyTest. Error: Microsoft.SharePoint.SPException: The trial period for this product has expired..
at Microsoft.Office.Server.UserProfiles.ProfileManagerBase.ValidateLicensing()
at Microsoft.Office.Server.UserProfiles.ProfileManagerBase..ctor(SPServiceContext serviceContext)
at Microsoft.Office.Server.UserProfiles.ProfileManagerBase..ctor(SPServiceContext serviceContext, Boolean ignorePrivacy)
at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(SPServiceContext serviceContext, Boolean IgnoreUserPrivacy, Boolean backwardCompatible)
at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(SPServiceContext serviceContext)
at Castle.Proxies.UserProfileManagerProxy..ctor(IEventsMixin, IMockReplicator, IMockMixin, IInterceptor[], SPServiceContext)
at DynamicMethod_6f2d60ffa4f94cb4ba57556150461ef9(Object[])
at ...()
at ..[](Func`1 )
at ..(Type , Object[] )
at ..(Type , List`1 , Type , Object[] )
at ..(Type , Type[] , ProxyGenerationOptions , Object[] , IInterceptor[] )
at Telerik.JustMock.Core.MocksRepository.Create(Type , Object[] , IEnumerable`1 , IEnumerable`1 , IEnumerable`1 , Type[] , Boolean , Boolean , IEnumerable`1 )
at ..Create(MocksRepository , Type , Object[] , Nullable`1 , Type[] , Nullable`1 , IEnumerable`1 , List`1 , List`1 , List`1 )
at Telerik.JustMock.Mock..()
at ..[](Func`1 )
at Telerik.JustMock.Mock.Create(Object[] args)
Has anyone else seen this issuue?