public void Matches_Default_Index() { var attr = new RenderIndexActionSelectorAttribute(); var req = new RequestContext(); var appCtx = new ApplicationContext( CacheHelper.CreateDisabledCacheHelper(), new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>())); var umbCtx = UmbracoContext.EnsureContext( Mock.Of <HttpContextBase>(), appCtx, new Mock <WebSecurity>(null, null).Object, Mock.Of <IUmbracoSettingsSection>(), Enumerable.Empty <IUrlProvider>(), true); var ctrl = new MatchesDefaultIndexController(umbCtx); var controllerCtx = new ControllerContext(req, ctrl); var result = attr.IsValidForRequest(controllerCtx, GetRenderMvcControllerIndexMethodFromCurrentType(ctrl.GetType())); Assert.IsTrue(result); }
public void Matches_Default_Index() { var globalSettings = TestObjects.GetGlobalSettings(); var attr = new RenderIndexActionSelectorAttribute(); var req = new RequestContext(); var umbracoContextFactory = new UmbracoContextFactory( Current.UmbracoContextAccessor, Mock.Of <IPublishedSnapshotService>(), new TestVariationContextAccessor(), new TestDefaultCultureAccessor(), TestObjects.GetUmbracoSettings(), globalSettings, new UrlProviderCollection(Enumerable.Empty <IUrlProvider>()), new MediaUrlProviderCollection(Enumerable.Empty <IMediaUrlProvider>()), Mock.Of <IUserService>()); var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of <HttpContextBase>()); var umbCtx = umbracoContextReference.UmbracoContext; var umbracoContextAccessor = new TestUmbracoContextAccessor(umbCtx); var ctrl = new MatchesDefaultIndexController { UmbracoContextAccessor = umbracoContextAccessor }; var controllerCtx = new ControllerContext(req, ctrl); var result = attr.IsValidForRequest(controllerCtx, GetRenderMvcControllerIndexMethodFromCurrentType(ctrl.GetType())); Assert.IsTrue(result); }
public void Matches_Default_Index() { var globalSettings = TestObjects.GetGlobalSettings(); var attr = new RenderIndexActionSelectorAttribute(); var req = new RequestContext(); //var appCtx = new ApplicationContext( // CacheHelper.CreateDisabledCacheHelper(), // new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>())); var umbCtx = UmbracoContext.EnsureContext( Current.UmbracoContextAccessor, Mock.Of <HttpContextBase>(), Mock.Of <IPublishedSnapshotService>(), new Mock <WebSecurity>(null, null, globalSettings).Object, TestObjects.GetUmbracoSettings(), Enumerable.Empty <IUrlProvider>(), globalSettings, new TestVariationContextAccessor(), true); var ctrl = new MatchesDefaultIndexController { UmbracoContext = umbCtx }; var controllerCtx = new ControllerContext(req, ctrl); var result = attr.IsValidForRequest(controllerCtx, GetRenderMvcControllerIndexMethodFromCurrentType(ctrl.GetType())); Assert.IsTrue(result); }