Tuesday

log file from folder for unit test

      
        [TestMethod]
        public void TransactionBalance_FilesTest()
        {

            const string exp = "System.Data.InvalidExpressionException: ";
            var test_files = Directory.GetFiles(@"c:\temp\usage", "*.txt");
            HashSet<string> h = new HashSet<string>();

            var regex1 = new Regex(@"([C|D]{1})([0-9]{2})([0-9]{2})([0-9]{2})([A-Z]{3})(-?\d.*)");
            int done1 = 0;
            int done2 = 0;
            foreach (var file in test_files)
            {
                foreach (var l in File.ReadAllLines(file))
                {
                    int pos = l.IndexOf(exp);
                    if (pos > -1)
                    {
                        var data = l.Substring(pos + exp.Length);


                        var match = regex1.Match(data);
                        if (match.Groups.Count < 7)
                        {
                            data = PreprocessData(data);
                            match = regex1.Match(data);
                            if (match.Groups.Count < 7)
                            {
                                if (!h.Contains(data))
                                {
                                    h.Add(data + "      =>ORIG=>  " + l);
                                }
                            }
                            else {
                                done2 += 1;
                            }
                        }
                        else {
                            done1 += 1;
                        }

                    }
                }
            }

            StringBuilder sb = new StringBuilder("completed "+done1+" second attempt="+done2+"\r\n");
            foreach (string item in h)
            {
                sb.AppendLine(item);
            }

            TestMaker tm = new TestMaker(man);
            Console.WriteLine(tm.Save("txt", sb.ToString()));
        }


   

No comments:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...