//Is it a Fidelity Index Fund //They all start with capital F and have 5 characters private bool FoundFIndexFunds(PFFind.data data) { string FIndexPattern = @"\bF\w*[A-Z]{4}\b"; Regex rgx = new Regex(FIndexPattern); MatchCollection matches_title = rgx.Matches(data.title); MatchCollection matches_text = rgx.Matches(data.selftext); //First match, check title if (matches_title.Count > 0) { foreach (Match m in matches_title) { if (!Funds.Contains(m.Value.ToUpper())) { this.Funds.Add(m.Value.ToUpper()); } } } //Second match, check text if (matches_text.Count > 0) { foreach (Match m in matches_text) { if (!Funds.Contains(m.Value.ToUpper())) { this.Funds.Add(m.Value.ToUpper()); } } } return(this.Funds.Count > 0 ? true : false); }
public static PFFind.data Four01k_2() { PFFind.data data = new PFFind.data() { id = "unit_testid", title = "This is a test to not find four01k", score = 4000, url = "https://test.com/", num_comments = 100, subreddit_id = "subreddit_id", selftext = "this is where the real test is four01k, then there is this four oh 1 k" }; return(data); }
//Index fund test case public static PFFind.data FIndexFund() { PFFind.data data = new PFFind.data() { id = "unit_testid", title = "This is a test to find fidelity index funds", score = 4000, url = "https://test.com/", num_comments = 100, subreddit_id = "subreddit_id", selftext = "this is where the real test is FUSVX, then there is this FSEVX" }; return(data); }
public static PFFind.data FIndexFund_2() { PFFind.data data = new PFFind.data() { id = "unit_testid", title = "This is a test to not find fidelity index funds", score = 4000, url = "https://test.com/", num_comments = 100, subreddit_id = "subreddit_id", selftext = "this is where the real test is FUSV (this is incorrect), then there is this fsevx (this is correct length" + " but not capitalized)" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }; return(data); }
//Is it a Fidelity Index Fund //They all start with capital F and have 5 characters private bool Found401k(PFFind.data data) { //First match, check title if (data.title.Contains(four01k)) { if (!Funds401k.Contains(data)) { this.Funds401k.Add(data); } } //Second match, check text if (data.selftext.Contains(four01k)) { if (!Funds401k.Contains(data)) { this.Funds401k.Add(data); } } return(this.Funds401k.Count > 0 ? true : false); }
public Four01k(PFFind.data data) { this.Funds401k = new List <PFFind.data>(); this.Found401k(data); }
public FIndexFunds(PFFind.data data) { this.Funds = new List <string>(); this.FoundFIndexFunds(data); }