void CreateHtmlElementFoldWithElementName(string elementName) { fold = new HtmlElementFold() { ElementName = elementName }; }
public void GetFolds_HtmlWithSingleParagraphStartAndEndTag_ReturnsTwoFolds() { CreateParser(); string text = "<html>\r\n" + "<p>\r\n" + "</p>\r\n" + "</html>"; GetFolds(text); var expectedFolds = new HtmlElementFold[] { new HtmlElementFold() { ElementName = "html", StartOffset = 0, EndOffset = 26 }, new HtmlElementFold() { ElementName = "p", StartOffset = 8, EndOffset = 17 } }; CollectionAssert.AreEqual(expectedFolds, folds); }
public void GetFolds_ParagraphStartAndEndTag_ReturnsOneFoldForParagraphTag() { CreateParser(); string text = "<p>\r\n" + "</p>"; GetFolds(text); var expectedFolds = new HtmlElementFold[] { new HtmlElementFold() { ElementName = "p", StartOffset = 0, EndOffset = 9 } }; CollectionAssert.AreEqual(expectedFolds, folds); }
public void GetFolds_ScriptTagAttributeHasAspxTagsInsideWithDoubleQuotes_ReturnsOneFoldIgnoringDoubleQuotesInsideScriptTagAttribute() { CreateParser(); string text = "<script src=\"<%: Url.Content(\"~/Scripts/jquery.js\") %>\" type=\"text/javascript\">\r\n" + "</script>\r\n"; GetFolds(text); var expectedFolds = new HtmlElementFold[] { new HtmlElementFold() { ElementName = "script", StartOffset = 0, EndOffset = 90 } }; CollectionAssert.AreEqual(expectedFolds, folds); }
public void GetFolds_DivTagWithClassAttribute_ReturnsOneFold() { CreateParser(); string text = "<div class=\"foo\">\r\n" + "</div>\r\n"; GetFolds(text); var expectedFolds = new HtmlElementFold[] { new HtmlElementFold() { ElementName = "div", StartOffset = 0, EndOffset = 25 } }; CollectionAssert.AreEqual(expectedFolds, folds); }
public void GetFolds_EndAnchorTagInsideIfStatement_ReturnsOneFoldForParagraphTagAndNotAnchorTag() { CreateCSharpParser(); string text = "@if (i<a || b>i) {\r\n" + " </a>\r\n" + " <p>\r\n" + " </p>\r\n" + "}\r\n"; GetFolds(text); var expectedFolds = new HtmlElementFold[] { new HtmlElementFold() { ElementName = "p", StartOffset = 34, EndOffset = 47 } }; CollectionAssert.AreEqual(expectedFolds, folds); }
void CreateHtmlElementFoldsForComparison() { lhs = new HtmlElementFold(); rhs = new HtmlElementFold(); }