Ejemplo n.º 1
0
        public void RedirectTest(string Entry, string Source, HttpStatusCode StatusCode, string Destination)
        {
            File.WriteAllText("Redirects3.config", Entry);
            Redirect.ParseRedirectFile("Redirects3.config");

            ResponseProvider Response = ExecuteSimpleRequest(Source, HttpMethod.GET, null);

            Assert.IsTrue(Response.StatusCode == StatusCode);
            Assert.IsTrue(Response.RedirectURL == Destination);
        }
Ejemplo n.º 2
0
        public void Resolve_Test(string Source, string Destination)
        {
            StringBuilder SB = new StringBuilder();

            SB.AppendLine("/a => /b");
            SB.AppendLine("/c => /a");
            SB.AppendLine("/e => /e");
            File.WriteAllText("Redirects1.config", SB.ToString());
            Redirect.ParseRedirectFile("Redirects1.config");
            Assert.IsTrue(Redirect.Resolve(Source) == Destination);
        }
Ejemplo n.º 3
0
        public void ParseRedirectFile_Test(string Entry)
        {
            StringBuilder SB = new StringBuilder();

            SB.AppendLine("/a => /b");
            SB.AppendLine(Entry);
            File.WriteAllText("Redirects2.config", SB.ToString());
            Redirect.ParseRedirectFile("Redirects2.config");

            Assert.IsTrue(Redirect.RedirectionDict.Count == 1);
            Assert.IsTrue(Redirect.RedirectionDict["/a"] == "/b");
        }