예제 #1
0
        public void NoFollowDisabled()
        {
            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\">#hashtag</a>";
            string actual   = instance.AutoLinkHashtags(tweet);

            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void NoFollowByDefault()
        {
            var    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>";
            string actual   = autolink.AutoLinkHashtags(tweet);

            Assert.AreEqual(expected, actual);
        }
        public void AutolinkHashtags()
        {
            var failures = new List <string>();

            foreach (var test in LoadTests <string>("autolink.yml", "hashtags"))
            {
                try
                {
                    string actual = autolink.AutoLinkHashtags(test.Text);
                    Assert.AreEqual(test.Expected, actual);
                }
                catch (Exception)
                {
                    failures.Add(test.Description + ": " + test.Text);
                }
            }

            if (failures.Any())
            {
                Assert.Fail(string.Join("\n", failures));
            }
        }