Exemplo n.º 1
0
 public void TestGetForm()
 {
     MockPage page = new MockPage();
     server.AddPage(page);
     string query = "?rabbits=funny&fortytwo=42&floating=134.2&german=99,31";
     WebUtils.ReadPage(server.Url + page.Name() + query);
     Assert.AreEqual("funny", page.Query["rabbits"]);
     Assert.AreEqual("42", page.Query["fortytwo"]);
     Assert.AreEqual("134.2", page.Query["floating"]);
     Assert.AreEqual("99,31", page.Query["german"]);
     Assert.AreEqual(4, page.Query.Count);
 }
Exemplo n.º 2
0
 public void TestPageWithoutHeaders()
 {
     MockPage page = new MockPage();
     server.AddPage(page);
     string text = WebUtils.PlainText(WebUtils.ReadPage(server.Url+page.Name()));
     Assert.IsTrue(text.Contains("test page"), "Didn't output test page");
     Assert.AreEqual(null, page.SystemName);
     Assert.AreEqual(null, page.CharName);
     Assert.AreEqual(null, page.CharId);
     Assert.AreEqual(1, page.Headers.Count);
     Assert.AreEqual("Host", page.Headers.GetKey(0));
 }
Exemplo n.º 3
0
 public void TestPageWithHeaders()
 {
     MockPage page = new MockPage();
     server.AddPage(page);
     NameValueCollection headers = new NameValueCollection();
     headers.Add("Eve.solarsystemname", "Sol");
     headers.Add("Eve.charname", "Mark");
     headers.Add("Eve.charid", "1");
     headers.Add("Eve.otherinformation", "Sunsets are beautiful");
     string text = WebUtils.PlainText(WebUtils.ReadPageWithHeaders(server.Url + page.Name(), headers, null));
     Assert.IsTrue(text.Contains("test page"), "Didn't output test page");
     Assert.AreEqual("Sol", page.SystemName);
     Assert.AreEqual("Mark", page.CharName);
     Assert.AreEqual("1", page.CharId);
     Assert.AreEqual(5, page.Headers.Count);
     Assert.AreEqual("Sunsets are beautiful", page.Headers["Eve.otherinformation"]);
 }