コード例 #1
0
 /// <summary>
 /// Initializes the UserLinks class with Post items determining nessecary things
 /// </summary>
 /// <param name="post">A <see cref="Post"/> of which you give in</param>
 /// <param name="regexes">A list of <see cref="Regex"/>es that you use for excluding links</param>
 /// <param name="reddit">A <see cref="Reddit"/> used for parameter parity with <see cref="UserLinks(Comment, Regex[], Reddit)"/></param>
 public UserLinks(Post post, Regex[] regexes, Reddit reddit)
 {
     this.Thing         = post;
     this.UserLinksType = UserLinkType.Post;
     Name         = post.AuthorName;
     ArchiveLinks = Mnemosyne2Reborn.ArchiveLinks.ArchivePostLinks(RegularExpressions.FindLinks(post.SelfTextHtml), regexes, post.Author);
 }
コード例 #2
0
        public void TestSameResults()
        {
            List <string> list1 = RegularExpressions.FindLinks(TestString);
            List <string> list2 = RegularExpressions.FindLinksE(TestString).ToList();

            Assert.IsTrue(list1.TrueForAll((s) => { return(list2.Contains(s)); }));
        }
コード例 #3
0
 /// <summary>
 /// Makes a Userlinks class from a comment, a list of regexes, and a Reddit
 /// </summary>
 /// <param name="comment">A <see cref="Comment"/> used to get the links and several other things</param>
 /// <param name="regexes">A list of <see cref="Regex"/> used for excluding links</param>
 /// <param name="reddit">A <see cref="Reddit"/> literally only used for getting a RedditUser</param>
 public UserLinks(Comment comment, Regex[] regexes, Reddit reddit)
 {
     this.Thing    = comment;
     Name          = comment.AuthorName;
     UserLinksType = UserLinkType.Comment;
     ArchiveLinks  = Mnemosyne2Reborn.ArchiveLinks.ArchivePostLinks(RegularExpressions.FindLinks(comment.BodyHtml), regexes, reddit.GetUser(comment.AuthorName));
 }
コード例 #4
0
 public void TestFindLinks()
 {
     Assert.IsTrue(RegularExpressions.FindLinks(TestString).Contains("https://www.nearlyfreespeech.net/"));
 }