示例#1
0
        public void NoFollowByDefaultTest()
        {
            autolink = new Autolink();
            String tweet    = "This has a #hashtag";
            String expected = "This has a <a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\" rel=\"nofollow\">#hashtag</a>";

            AssertAutolink(expected, autolink.AutoLinkHashtags(tweet));
        }
示例#2
0
        public void AutolinkHashtagsTest()
        {
            List <string> failures = new List <string>();

            foreach (dynamic test in LoadTestSection <string>("hashtags"))
            {
                string actual = string.Empty;
                try
                {
                    actual = autolink.AutoLinkHashtags(test.text);
                    Assert.AreEqual(test.expected, actual);
                }
                catch (Exception)
                {
                    failures.Add(string.Format("\n{0}: {1}\n\tExpected: {2}\n\t  Actual: {3}", test.description, test.text, test.expected, actual));
                }
            }
            if (failures.Any())
            {
                Assert.Fail(string.Join("\n", failures));
            }
        }
示例#3
0
 public void NoFollowByDefaultTest()
 {
     autolink = new Autolink();
     String tweet = "This has a #hashtag";
     String expected = "This has a <a href=\"https://twitter.com/#!/search?q=%23hashtag\" title=\"#hashtag\" class=\"tweet-url hashtag\" rel=\"nofollow\">#hashtag</a>";
     AssertAutolink(expected, autolink.AutoLinkHashtags(tweet));
 }