public void FitNesseFormatterParseNameValueCollectionTest() { const string input = "header1:value1\nheader2 : value2\n header3: value3:a "; var actual = FitNesseFormatter.ParseNameValueCollection(input); Assert.AreEqual(3, actual.Count); Assert.AreEqual("value1", actual.Get("header1")); Assert.AreEqual("value2", actual.Get("header2")); Assert.AreEqual("value3:a", actual.Get("header3")); }
public void FitNesseFormatterHeaderListTest() { var headerList = new NameValueCollection { { "header1", "value1" }, { "header2", "value2" }, { "header3", "value3" } }; var result = FitNesseFormatter.HeaderList(headerList); Assert.AreEqual("header1: value1\nheader2: value2\nheader3: value3\n", result); }
public void FitNesseFormatterParseCookiesTest() { const string input = "id=abc;expires=Sun, 14 Jun 2020 20:45:30 GMT;path=/; domain=.example.com; HttpOnly\n" + "cookie2=test\n" + "_qa=name=john&age=47;domain=voorbeeld.nl;secure;path=/a/b\n" + "maxAgeTest1=ok;max-Age=86400\n" + "maxAgeTest2=good; max-Age=86401; Expires=bogus value with 12:34:56\n" + "maxAgeTest3=bad; max-Age=86402; MyExpires=bogus value with 12:34:56\n" + "maxAgeTest4=ugly;Expires=; max-Age=86403"; var actual = FitNesseFormatter.ParseCookies(input, "default.org", new DateTime(2019, 6, 16, 11, 12, 13)); Assert.AreEqual(7, actual.Count); var cookieList = FitNesseFormatter.CookieList(actual); Assert.AreEqual( "id=abc; Expires=Sun, 14 Jun 2020 20:45:30 GMT; Path=/; Domain=.example.com; HttpOnly\n" + "cookie2=test; Path=/; Domain=default.org\n" + "_qa=name=john&age=47; Path=/a/b; Domain=voorbeeld.nl; Secure\n" + "maxAgeTest1=ok; Expires=Mon, 17 Jun 2019 11:12:13 GMT; Path=/; Domain=default.org\n" + "maxAgeTest2=good; Expires=Mon, 17 Jun 2019 11:12:14 GMT; Path=/; Domain=default.org\n" + "maxAgeTest3=bad; Expires=Mon, 17 Jun 2019 11:12:15 GMT; Path=/; Domain=default.org\n" + "maxAgeTest4=ugly; Expires=Mon, 17 Jun 2019 11:12:16 GMT; Path=/; Domain=default.org", cookieList); }
public void FitNesseFormatterParseCookiesErrorTest() { const string input = "="; _ = FitNesseFormatter.ParseCookies(input, null, DateTime.UtcNow); }