Exemple #1
0
        public void ShowSampleStatistics()
        {
            var files = Directory.GetFiles(@"..\..\..\Whois.Tests\Samples\Domains", "*.txt");
            var visitor = new PatternExtractorVisitor();

            foreach (var file in files)
            {
                var text = File.ReadAllText(file);

                var record = new WhoisRecord(text);

                var matches = visitor.MatchPatterns(record);

                if (matches.Any())
                {
                    var match = matches.First();

                    Console.WriteLine("{0} matches: {1}", match.Replacements.Count, Path.GetFileName(file));
                }
                else
                {
                    Console.WriteLine("No matches: {0}", file);
                }
            }
        }
        public void TestParseTopDomains()
        {
            var fails = new List<string>();
            var files = Directory.GetFiles("..\\..\\Samples", "*.txt");

            var visitor = new PatternExtractorVisitor();

            foreach (var file in files)
            {
                var text = File.ReadAllText(file);

                var record = new WhoisRecord(text);

                var matches = visitor.MatchPatterns(record);

                if (matches[0].Replacements.Count == 0)
                {
                    fails.Add(file);
                }
                else
                {
                    Console.WriteLine("{0} replacement(s) made in {1}", matches[0].Replacements.Count, file);
                }
            }

            foreach (var fail in fails)
            {
                Console.WriteLine("No replacements made in: {0}", fail);
            }

            if (fails.Count > 0)
            {
                Assert.Fail("No replacements made for some files, check output!");
            }
        }
 public void SetUp()
 {
     visitor = new PatternExtractorVisitor();
 }
        public void SetUp()
        {
            SerilogConfig.Init();

            visitor = new PatternExtractorVisitor();
        }
Exemple #5
0
 public void SetUp()
 {
     visitor = new PatternExtractorVisitor();
 }