Exemplo n.º 1
0
        public void TestAnalyse_没有输入项的普通文本()
        {
            HTMLAnalyser     analyser = new HTMLAnalyser();
            List <InputItem> list     = analyser.Analyse("afasldlajdgljaldjlajfljasdlfjasdf");

            Assert.AreEqual(0, list.Count);
        }
Exemplo n.º 2
0
        public void TestAnalyse_分析空字符串()
        {
            HTMLAnalyser     analyser = new HTMLAnalyser();
            List <InputItem> list     = analyser.Analyse(string.Empty);

            Assert.AreEqual(0, list.Count);
        }
Exemplo n.º 3
0
        public void TestAnalyse_没有输入项的HTML()
        {
            StreamReader reader = new StreamReader(TestContext.TestDeploymentDir + @"\HTMLs\01.htm");
            string       html   = reader.ReadToEnd();

            HTMLAnalyser     analyser = new HTMLAnalyser();
            List <InputItem> list     = analyser.Analyse(html);

            Assert.AreEqual(0, list.Count);
        }
Exemplo n.º 4
0
        public void TestGetItemByHTML_有属性()
        {
            string html = "<tag:Item DisplayName=\"规格介绍\" valuetype=\"Image\"></tag>";

            HTMLAnalyser analyser = new HTMLAnalyser();
            InputItem    item     = analyser.GetItemByHTML(html);

            Assert.AreEqual(InputType.Item, item.InputType);
            Assert.AreEqual("<tag:Item DisplayName=\"规格介绍\" valuetype=\"Image\"></tag>", item.OuterHTML);
            Assert.AreEqual("", item.InnerHTML);

            Assert.AreEqual("规格介绍", item.DisplayName);
            Assert.AreEqual(default(string), item.ItemValue);
            Assert.AreEqual(default(string), item.DefaultValue);
            Assert.AreEqual(TOP.Common.AnalyseTool.ValueType.Image, item.ValueType);
        }
Exemplo n.º 5
0
        public void TestAnalyse_有一个Item输入项()
        {
            StreamReader reader = new StreamReader(TestContext.TestDeploymentDir + @"\HTMLs\02.htm");
            string       html   = reader.ReadToEnd();

            HTMLAnalyser     analyser = new HTMLAnalyser();
            List <InputItem> list     = analyser.Analyse(html);

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual("规格介绍", list[0].DisplayName);
            Assert.AreEqual(InputType.Item, list[0].InputType);
            Assert.AreEqual(default(string), list[0].ItemValue);
            Assert.AreEqual(TOP.Common.AnalyseTool.ValueType.Image, list[0].ValueType);
            Assert.AreEqual(default(string), list[0].DefaultValue);
            Assert.AreEqual(string.Empty, list[0].InnerHTML.Trim());
        }