public void TestSearchBe() { var policeMan = new CharsetPoliceMan(); var body = "<html><head><meta charset=\"utf-16\"></head>"; var expected = 36; var actual = policeMan.SearchCharset(Encoding.BigEndianUnicode.GetBytes(body)); Assert.AreEqual(expected, actual, "charsetが含まれている。"); }
public void TestSearchCharsetUppercase() { var policeMan = new CharsetPoliceMan(); var body = "<HTML><HEAD><META CHARSET=\"UTF-8\"></HEAD>"; // 当面大文字は無視 //var expected = 18; var expected = -1; var actual = policeMan.SearchCharset(Encoding.UTF8.GetBytes(body)); Assert.AreEqual(expected, actual, "CHARSETが含まれているが対象外。"); }