Esempio n. 1
0
        public void TestRender()
        {
            factory.ArchiveCalls = 0;
            string html          = page.Render(null, null, null, emptyHeaders, emptyQuery);
            string lowerCaseText = WebUtils.PlainText(html).ToLower();

            Assert.IsTrue(lowerCaseText.Contains("navitas"), "No mention of the navitas reports");
            Assert.IsTrue(lowerCaseText.Contains("kernite"), "No mention of the kernite reports");
            Assert.IsTrue(lowerCaseText.Contains("the citadel"), "No mention of the citadel");
            Assert.IsTrue(lowerCaseText.Contains("lonetrek"), "No mention of lonetrek");
            Assert.IsTrue(lowerCaseText.Contains("long-limbed roes"), "No mention of long-limbed roes (was it split at the hyphen?)");

            int navitasPosition = lowerCaseText.IndexOf("navitas");
            int kernitePosition = lowerCaseText.IndexOf("kernite");
            int roesPosition    = lowerCaseText.IndexOf("long-limbed roes");

            // should be sorted by date (oldest first): kernite, navitas, roes
            Assert.Less(kernitePosition, navitasPosition, "The Kernite and Navitas were not sorted by date (Kernite should come first)");
            Assert.Less(navitasPosition, roesPosition, "The Navitas and Long-Limbed Roes were not sorted by date (Navitas should come first)");

            // Archive old logs should be called once per render
            Assert.AreEqual(1, factory.ArchiveCalls);

            Assert.IsTrue(html.Contains(ConfigurationSettings.AppSettings["URLPrefix"] + "Reports?archive=old"), "No link to archive old reports");
            Assert.IsTrue(html.Contains(ConfigurationSettings.AppSettings["URLPrefix"] + "Reports?archive=all"), "No link to archive all reports");
            Assert.IsTrue(html.Contains(ConfigurationSettings.AppSettings["URLPrefix"] + "Search"), "No search link");
            Assert.IsTrue(html.Contains(ConfigurationSettings.AppSettings["URLPrefix"] + "Reports"), "No refresh reports link");
        }