예제 #1
0
        public void TestParseSSNs(string ssn, bool truth)
        {
            List <string> ssns = new List <string>
            {
                ssn
            };
            List <Match> matches = FAStrings.ParseSSNs(ssns);
            int          c       = matches.Count;
            bool         b       = (c == 1);

            Assert.AreEqual(truth, b);
        }
예제 #2
0
        public void TestParseDLLs2()
        {
            //Not dlls
            List <string> dlls = new List <string>
            {
                "win32.dllo",
                "kernelw.oejf.dll",
                "win32api.dl",
                "system32"
            };
            List <Match> matches = FAStrings.ParseDLLs(dlls);

            Assert.AreEqual(0, matches.Count);
        }
예제 #3
0
        public void TestParseWebsites2()
        {
            List <string> websites = new List <string>
            {
                "http://oreilly.com",
                "http://google.com"
            };
            List <Match>  matches    = FAStrings.ParseWebsites(websites);
            List <string> strMatches = new List <string>();

            foreach (Match m in matches)
            {
                strMatches.Add(m.Value);
            }
            foreach (string s in websites)
            {
                Assert.Contains(s, strMatches);
            }
        }
예제 #4
0
        public void TestParseDLLs1()
        {
            List <string> dlls = new List <string>
            {
                "win32.dll",
                "kernel.dll",
                "win32api.dll",
                "system32.dll"
            };
            List <Match>  matches    = FAStrings.ParseDLLs(dlls);
            List <string> strMatches = new List <string>();

            foreach (Match m in matches)
            {
                strMatches.Add(m.Value);
            }
            foreach (string s in dlls)
            {
                Assert.Contains(s, strMatches);
            }
        }
예제 #5
0
        public void TestParseWebsites3()
        {
            List <string> websites = new List <string>
            {
                @"https://learning.oreilly.com/library/view/program",
                @"https://learning.oreilly.com",

                @"http://google.com/flights"
            };
            List <Match>  matches    = FAStrings.ParseWebsites(websites);
            List <string> strMatches = new List <string>();

            foreach (Match m in matches)
            {
                strMatches.Add(m.Value);
            }
            foreach (string s in websites)
            {
                Assert.Contains(s, strMatches);
            }
        }
예제 #6
0
        public void TestParseWebsites4()//website regex needs work...
        {
            //the realistic hard ones... maybe split these  up
            List <string> websites = new List <string>
            {
                @"https://learning.oreilly.com/library/view/programming-for-the/9781509302154/ch03.html#ch03",
                @"https://github.com/MicrosoftLearning/20483-Programming-in-C-Sharp/blob/master/Instructions/20483C_MOD01_LAB_MANUAL.md",

                @"https://www.amazon.com/kuman-3O-IUX5-O0TZ-Digital-Oscilloscope-pre-soldered/dp/B0195ZIURK/ref=lp_393269011_1_9?s=industrial&ie=UTF8&qid=1590246868&sr=1-9"
            };
            List <Match>  matches    = FAStrings.ParseWebsites(websites);
            List <string> strMatches = new List <string>();

            foreach (Match m in matches)
            {
                strMatches.Add(m.Value);
            }
            foreach (string s in websites)
            {
                Assert.Contains(s, strMatches);
            }
        }