コード例 #1
0
        public void EntryTest2()
        {
            for (int x = 0; x < 2; x++)
            {
                for (int y = 0; y < 1000; y++)
                {
                    string[] fields = null;

                    var lines     = File.ReadLines(Path.Combine(Directory.GetCurrentDirectory(), "entry.csv"));
                    int lineCount = File.ReadAllLines(Path.Combine(Directory.GetCurrentDirectory(), "entry.csv")).Length;

                    if (y > lineCount - 1)
                    {
                        break;
                    }

                    var line = new List <string>(lines)[y];

                    TextFieldParser parser = new TextFieldParser(new StringReader(line));
                    parser.HasFieldsEnclosedInQuotes = true;
                    parser.SetDelimiters(",");
                    fields = parser.ReadFields();

                    using (Entry entry = new Entry(x == 0 ? _legacySourcePath : _modernSourcePath))
                    {
                        if (fields[0].Length > 0)
                        {
                            entry.AddFilterCriteria(Entry.EntryFields.EntryRecd, ComparisonType.EqualTo, fields[0]);
                        }

                        if (fields[1].Length > 0)
                        {
                            entry.AddFilterCriteria(Entry.EntryFields.EntryCode, ComparisonType.EqualTo, fields[1]);
                        }

                        if (fields[2].Length > 0)
                        {
                            entry.AddFilterCriteria(Entry.EntryFields.EntryDescription, ComparisonType.EqualTo, fields[2]);
                        }

                        if (fields[3].Length > 0)
                        {
                            entry.AddFilterCriteria(Entry.EntryFields.EntryTable, ComparisonType.EqualTo, Convert.ToInt32(fields[3]));
                        }

                        var entryList = entry.EntryList();

                        if (entryList.Count == 0)
                        {
                            Assert.Fail("Match failed on line: " + (y + 1).ToString());
                        }
                    }
                }
            }

            Assert.IsTrue(true, "EntryTest2 Passed!!");
        }