public void GetPageTitleFromResource_HasResourceForOverridePageType() { var ctrl = Core.Services.Utils.DependencyResolver.Current.Get <MyContentControllerBase>(); FakeResources.AddString("PageTitle", "PAGETYPE_MyOverride", "my override page type title"); var res = ctrl.CallGetPageTitleFromResource("MyOverride"); Assert.Contains("my override page type title", res); }
public void GetPageTitleFromResource_NoResourceForOverridePageType_UsesDefault() { var ctrl = Core.Services.Utils.DependencyResolver.Current.Get <MyContentControllerBase>(); FakeResources.AddString("PageTitle", "PAGETYPE_MyOverride", string.Empty); FakeResources.AddString("PageTitle", "PAGETYPE_AllOthers", "my all other title"); var res = ctrl.CallGetPageTitleFromResource("MyOverride"); Assert.Contains("my all other title", res); }
public void GetPageTitleFromResource_HasResourceForPageType_RemovesPageSuffixFromTypeName() { var ctrl = Core.Services.Utils.DependencyResolver.Current.Get <MyContentControllerBaseWithSuffix>(); ctrl.MyCurrentPage = new MyContentItemWithSuffixPage(); FakeResources.AddString("PageTitle", "PAGETYPE_MyContentItemWithSuffix", "my resource title"); var res = ctrl.CallGetPageTitleFromResource(); Assert.Contains("my resource title", res); }
public void SetPageTitleOverrideResKey_CallsGetPageTitleWithOverride() { var ctrl = Core.Services.Utils.DependencyResolver.Current.Get <MyContentControllerBase>(); ctrl.MyCurrentPage.PageTitle = string.Empty; FakeResources.AddString("PageTitle", "PAGETYPE_MyOverride", "my override type title"); ctrl.CallSetPageTitleOverrideResKey("MyOverride"); Assert.Contains("my override type title", ctrl.ViewBag.Title); }
public void GetPageTitle_FallsBackToDefaultResource() { var ctrl = Core.Services.Utils.DependencyResolver.Current.Get <MyContentControllerBase>(); ctrl.MyCurrentPage.PageTitle = string.Empty; FakeResources.AddString("PageTitle", "PAGETYPE_MyContentItem", string.Empty); FakeResources.AddString("PageTitle", "PAGETYPE_AllOthers", "my all other title"); var res = ctrl.CallGetPageTitle(); Assert.Contains("my all other title", res); }
public void GetPageTitle_FavorsCurrentItem() { var ctrl = Core.Services.Utils.DependencyResolver.Current.Get <MyContentControllerBase>(); ctrl.MyCurrentPage.PageTitle = "my content item title"; FakeResources.AddString("PageTitle", "PAGETYPE_MyContentItem", "my page type title"); FakeResources.AddString("PageTitle", "PAGETYPE_AllOthers", "my all other title"); var res = ctrl.CallGetPageTitle(); Assert.Contains("my content item title", res); }