I've been converting one of the modules we work on to MVC so that I can integrate Unit Testing (the plan is to convert all of the modules we work on). I've been running into some snags working with DNN-specific functions and I'm looking for some general advice on what have others done in this type of situation. So far I've been creating Fake functions but some of the functionality I need is pretty extensive: stuff like DataProvider and getting Portal Vocabulary. For the DNN DataProvider I just created a Fake DataProvider that only has the one function I've run into (so far) but I would much rather leverage DNN's actual DataProvider instead of piece-mealing it as I come across function usage in my code.
Currently, I'm stuck on getting the Portal Vocabularies as everything is either an Interface or a Read-Only property, specifically the DotNetNuke.Entities.Content.Taxonomy.Vocabulary.Terms property (I think I can fake the rest of what I need for Vocabulary if this property could be set).
So far this is what I have for my Fake functions:
DotNetNuke.Entities.Portals.Fakes.ShimPortalSettings.CurrentGet = () =>
new PortalSettings { PortalId = TestPortalId, PortalName = "My Portal Name", PortalAlias = PortalAlias };
DotNetNuke.Common.Utilities.Fakes.ShimDataCache.GetCacheString = new FakesDelegates.Func<string, object>(GetCacheStringTest);
DotNetNuke.Common.Utilities.Fakes.ShimDataCache.SetCacheStringObject = new FakesDelegates.Action<string, object>(SetCacheStringTest);
DotNetNuke.Common.Utilities.Fakes.ShimConfig.GetDataBaseOwner = () => "dbo.";
DotNetNuke.Common.Utilities.Fakes.ShimConfig.GetObjectQualifer = () => "";
DotNetNuke.Data.Fakes.ShimDataProvider.Instance = new FakesDelegates.Func<DotNetNuke.Data.DataProvider>(GetDataProvider);
//DotNetNuke.Entities.Users.UserController.Instance.GetCurrentUserInfo();
DotNetNuke.Entities.Users.Fakes.ShimUserController.GetCurrentUserInfo = new FakesDelegates.Func<DotNetNuke.Entities.Users.UserInfo>(GetUserInfo);
DotNetNuke.Entities.Portals.Fakes.ShimPortalController.GetPortalSettingsDictionaryInt32 = new FakesDelegates.Func<int, System.Collections.Generic.Dictionary<string, string>>(GetPortalSettingsDirectoryTest);
//DotNetNuke.Entities.Content.Taxonomy.VocabularyController().GetVocabularies()
DotNetNuke.Entities.Content.Taxonomy.Fakes.ShimVocabularyController.AllInstances.GetVocabularies = new FakesDelegates.Func<DotNetNuke.Entities.Content.Taxonomy.VocabularyController, System.Linq.IQueryable<DotNetNuke.Entities.Content.Taxonomy.Vocabulary>>(GetVocabulariesTest);
Which, quite frankly, seems ridiculous: I feel like there has to be a better way of doing these functions then to just recreate every piece of DNN I need to use. I welcome any advice or suggestions with trying to utilize DNN functionality in my Unit Tests as I'm just stumped on how to do it without faking literally everything.