Exemplo n.º 1
0
 public virtual void TestCharset()
 {
     NUnit.Framework.Assert.AreEqual("utf-8", DataUtil.GetCharsetFromContentType("text/html;charset=utf-8 "));
     NUnit.Framework.Assert.AreEqual("UTF-8", DataUtil.GetCharsetFromContentType("text/html; charset=UTF-8"));
     NUnit.Framework.Assert.AreEqual("ISO-8859-1", DataUtil.GetCharsetFromContentType("text/html; charset=ISO-8859-1"
                                                                                      ));
     NUnit.Framework.Assert.AreEqual(null, DataUtil.GetCharsetFromContentType("text/html"));
     NUnit.Framework.Assert.AreEqual(null, DataUtil.GetCharsetFromContentType(null));
     NUnit.Framework.Assert.AreEqual(null, DataUtil.GetCharsetFromContentType("text/html;charset=Unknown"));
 }
Exemplo n.º 2
0
 public virtual void TestQuotedCharset()
 {
     NUnit.Framework.Assert.AreEqual("utf-8", DataUtil.GetCharsetFromContentType("text/html; charset=\"utf-8\""
                                                                                 ));
     NUnit.Framework.Assert.AreEqual("UTF-8", DataUtil.GetCharsetFromContentType("text/html;charset=\"UTF-8\"")
                                     );
     NUnit.Framework.Assert.AreEqual("ISO-8859-1", DataUtil.GetCharsetFromContentType("text/html; charset=\"ISO-8859-1\""
                                                                                      ));
     NUnit.Framework.Assert.AreEqual(null, DataUtil.GetCharsetFromContentType("text/html; charset=\"Unsupported\""
                                                                              ));
     NUnit.Framework.Assert.AreEqual("UTF-8", DataUtil.GetCharsetFromContentType("text/html; charset='UTF-8'"));
 }
Exemplo n.º 3
0
 public virtual void ShouldReturnNullForIllegalCharsetNames()
 {
     NUnit.Framework.Assert.AreEqual(null, DataUtil.GetCharsetFromContentType("text/html; charset=$HJKDF§$/("));
 }
Exemplo n.º 4
0
 public virtual void ShouldCorrectCharsetForDuplicateCharsetString()
 {
     NUnit.Framework.Assert.AreEqual("iso-8859-1", DataUtil.GetCharsetFromContentType("text/html; charset=charset=iso-8859-1"
                                                                                      ));
 }
Exemplo n.º 5
0
 public virtual void ShouldSelectFirstCharsetOnWeirdMultileCharsetsInMetaTags()
 {
     NUnit.Framework.Assert.AreEqual("ISO-8859-1", DataUtil.GetCharsetFromContentType("text/html; charset=ISO-8859-1, charset=1251"
                                                                                      ));
 }
Exemplo n.º 6
0
 public virtual void ShouldNotThrowExceptionOnEmptyCharset()
 {
     NUnit.Framework.Assert.AreEqual(null, DataUtil.GetCharsetFromContentType("text/html; charset="));
     NUnit.Framework.Assert.AreEqual(null, DataUtil.GetCharsetFromContentType("text/html; charset=;"));
 }