Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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)));
        }