The reason I got JustMock was so that I could unit test my custom code for a Sitefinity 5 project. I needed it because the methods for interfacing with Sitefinity make prolific use of static classes. I am, however, unable to mock some things in Sitefinity. Here are some examples involving the PageManager:
When I try to do this (so that I can arrange PageManager.GetManager()):
I get this:
GenericArguments[1], 'TItem', on 'Telerik.Sitefinity.Data.GetQuery`2[TProvider,TItem]' violates the constraint of type parameter 'TItem'.
When I try to do this:
I get this:
GenericArguments[0], 'Telerik.Sitefinity.GenericContent.Model.ILocatable', on 'Void Intercept[TItem](TItem, Boolean, Telerik.Sitefinity.Modules.GenericContent.ContentManagerBase`1[Telerik.Sitefinity.Modules.Pages.PageDataProvider], Boolean ByRef)' violates the constraint of type 'TItem'.
The eventual goal is for me to mock the call "GetPageNode" on the PageManager. Unfortunately, an interface containing that call is not provided on the PageManager.
Any ideas?
When I try to do this (so that I can arrange PageManager.GetManager()):
Mock.SetupStatic(
typeof
(PageManager), StaticConstructor.NonMocked);
I get this:
GenericArguments[1], 'TItem', on 'Telerik.Sitefinity.Data.GetQuery`2[TProvider,TItem]' violates the constraint of type parameter 'TItem'.
When I try to do this:
var pageManager = Mock.Create<PageManager>(Constructor.Mocked);
I get this:
GenericArguments[0], 'Telerik.Sitefinity.GenericContent.Model.ILocatable', on 'Void Intercept[TItem](TItem, Boolean, Telerik.Sitefinity.Modules.GenericContent.ContentManagerBase`1[Telerik.Sitefinity.Modules.Pages.PageDataProvider], Boolean ByRef)' violates the constraint of type 'TItem'.
The eventual goal is for me to mock the call "GetPageNode" on the PageManager. Unfortunately, an interface containing that call is not provided on the PageManager.
Any ideas?