public void RewriteUrl_NoTWellFormedDataInXMLFile_Test() { using (HttpSimulator httpSimulator = GetStandardSimulatedRequest()) { PageAssemblyInstructionLoader_Accessor target = new PageAssemblyInstructionLoader_Accessor(); HttpContext context = HttpContext.Current; string url = "/cancertopics_not_wellformed"; target.RewriteUrl(context, url); Assert.IsNull(PageAssemblyContext.Current.PageAssemblyInstruction, "PageAssemblyContext.Current.PageAssemblyInstruction is null"); } }
public void RewriteUrlMultiPage_Cancertopics_Web_Test() { using (HttpSimulator httpSimulator = GetStandardSimulatedRequest()) { PageAssemblyInstructionLoader_Accessor target = new PageAssemblyInstructionLoader_Accessor(); HttpContext context = HttpContext.Current; string url = "/multicancertopics/page1"; target.RewriteUrl(context, url); Assert.IsNotNull(PageAssemblyContext.Current, "PageAssemblyContext.Current is null"); Assert.IsNotNull(PageAssemblyContext.Current.PageAssemblyInstruction, "PageAssemblyContext.Current.PageAssemblyInstruction is null"); Assert.AreEqual(DisplayVersions.Web, PageAssemblyContext.Current.DisplayVersion); } }
public void RegisterFieldFilters_Test() { using (HttpSimulator httpSimulator = GetStandardSimulatedRequest()) { PageAssemblyInstructionLoader_Accessor target = new PageAssemblyInstructionLoader_Accessor(); HttpContext context = HttpContext.Current; string url = "/multicancertopics/page2"; target.RewriteUrl(context, url); Object[] args = new Object[] { 2 }; IPageAssemblyInstruction actual = PageAssemblyInstructionFactory.GetPageAssemblyInfo("/multicancertopics"); actual.GetType().InvokeMember("RegisterFieldFilters", BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, actual, args); } }
public void GetPageSnippets_Test() { using (HttpSimulator httpSimulator = GetStandardSimulatedRequest()) { PageAssemblyInstructionLoader_Accessor target = new PageAssemblyInstructionLoader_Accessor(); HttpContext context = HttpContext.Current; string url = "/multicancertopics/page2"; int snippetCount = 2; target.RewriteUrl(context, url); IPageAssemblyInstruction actual = PageAssemblyInstructionFactory.GetPageAssemblyInfo("/multicancertopics"); List <SnippetInfo> boolContainsUrl = (List <SnippetInfo>)actual.GetType().InvokeMember("GetPageSnippets", BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, actual, null); Assert.AreEqual(snippetCount, boolContainsUrl.Count); } }
public void RewriteUrl_Cancertopics_Web_Test() { using (HttpSimulator httpSimulator = GetStandardSimulatedRequest()) { PageAssemblyInstructionLoader_Accessor target = new PageAssemblyInstructionLoader_Accessor(); HttpContext context = HttpContext.Current; string url = "/cancertopics"; target.RewriteUrl(context, url); PageTemplateInfo pti = GetWebPageTemplateInfo(); string path = VirtualPathUtility.ToAbsolute(pti.PageTemplatePath); Assert.IsNotNull(PageAssemblyContext.Current, "PageAssemblyContext.Current is null"); Assert.IsNotNull(PageAssemblyContext.Current.PageAssemblyInstruction, "PageAssemblyContext.Current.PageAssemblyInstruction is null"); Assert.AreEqual(pti, PageAssemblyContext.Current.PageTemplateInfo); Assert.AreEqual(DisplayVersions.Web, PageAssemblyContext.Current.DisplayVersion); Assert.AreEqual(GetCancerTopicsSinglePageAssemblyInstuction(), PageAssemblyContext.Current.PageAssemblyInstruction); Assert.AreEqual(path, HttpContext.Current.Request.Path); //Check if the rewrite is pointing to the correct aspx page. //TODO: Check for where the variable used for the rewrite log is stored. } }