public void EncodeString() { // Arrange HtmlHelper htmlHelper = new HtmlHelper(new ModelStateDictionary()); var text = "<br />"; // Act string encodedHtml = htmlHelper.Encode(text); // Assert Assert.AreEqual(encodedHtml, "<br />", "Text is not being properly HTML-encoded."); }
public void EncodeStringNull() { // Arrange HtmlHelper htmlHelper = new HtmlHelper(new ModelStateDictionary()); string text = null; // Act string encodedHtml = htmlHelper.Encode(text); // Assert Assert.AreEqual("", encodedHtml); }
public void EncodeObjectNull() { // Arrange HtmlHelper htmlHelper = new HtmlHelper(new ModelStateDictionary()); object text = null; // Act string encodedHtml = htmlHelper.Encode(text); // Assert Assert.AreEqual(String.Empty, encodedHtml); }