public static IDisposable WrapWithLink(this HtmlHelper helper, string url) { if (String.IsNullOrEmpty(url)) return null; var wrapper = new LinkWrapper(helper.ViewContext.Writer, url); wrapper.BeginWrap(); return wrapper; }
public static IDisposable WrapWithLink(this HtmlHelper helper, string url) { if (String.IsNullOrEmpty(url)) { return(null); } var wrapper = new LinkWrapper(helper.ViewContext.Writer, url); wrapper.BeginWrap(); return(wrapper); }
public void ContentIsWrappedWithLinkOnceDisposed() { const string url = "http://someurl.com"; const string content = "Text to wrap"; var writer = new StringWriter(); using (var wrapper = new LinkWrapper(writer, url)) { wrapper.BeginWrap(); writer.Write(content); } Assert.That(writer.ToString(), Is.EqualTo(string.Format("<a href=\"{0}\">{1}</a>", url, content))); }