Example #1
0
        static void Main(string[] args)
        {
            ExcelParser excelFileParser = new ExcelParser(@"C:\Users\Ronald\Documents\MultiImsiV2\com\ProductDoc\Val\VTP_VTR\MultiImsiV2_001_VTP_VTR.xlsx");
            excelFileParser.Parse();
            VbProjParser vbProjectParser = new VbProjParser(@"C:\Users\Ronald\Documents\MultiImsiV2\valid\sc_valid_net\Stand_Prop_Projects\Mobcom\MultiIMSIV2\", "MultiIMSIV2.vbproj");
            vbProjectParser.Parse();

            //Console.WriteLine(excelFileParser.TestCases.Count);
            //Console.WriteLine(vbProjectParser.TestCases.Count);

            //Console.WriteLine(excelFileParser.TestCases[1].TestName);  h  6

               List<TestMerge> MainTestCase = new List<TestMerge>();

            // do mapping for excel
            PhysicalFileNameComparer comparer = new PhysicalFileNameComparer();
            foreach (var currrentExcel in excelFileParser.TestCases)
            {
                int indexTraverse = 0;
                string excelTestName = currrentExcel.TestName;
                while (indexTraverse < vbProjectParser.TestCases.Count)
                {
                    TestCase currentVB = vbProjectParser.TestCases[indexTraverse];
                    string vbTestName = PhysicalFileNameComparer.extractFileNameOnly(currentVB.TestPhysicalFileName);
                    int valo = string.Compare(excelTestName, vbTestName, false);

                    if (valo == 0)
                    {
                        currrentExcel.isMatch = true;
                        currentVB.isMatch = true;
                        MainTestCase.Add(new TestMerge() { excelSource = currrentExcel, vbSource = currentVB });
                        break;
                    }
                    if (valo < 0)
                    {
                        break;
                    }
                    indexTraverse++;
                }
            }

            //removal of same test
            int removeFromExcel =  excelFileParser.TestCases.RemoveAll(p => p.isMatch);
            int removeFromVB = vbProjectParser.TestCases.RemoveAll(p => p.isMatch);

            // set the unmapped test
            Console.WriteLine("unmapped VB proj");
            foreach (var vpo in vbProjectParser.TestCases)
            {
                Console.WriteLine(vpo.TestPhysicalFileName);
            }
            Console.WriteLine("unmapped excel");
            foreach (var vpo in excelFileParser.TestCases)
            {
                Console.WriteLine(vpo.TestName);
            }
            // do mapping for the rest

            Console.ReadKey();
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ExcelParser excelFileParser = new ExcelParser(VTPLocationText.Text);
            excelFileParser.Parse();
            VbProjParser vbProjectParser = new VbProjParser(
                Path.GetDirectoryName(VBProjLocationText.Text),
                Path.GetFileName(VBProjLocationText.Text));
            vbProjectParser.Parse();
            List<TestMerge> MainTestCase = new List<TestMerge>();

            mergeRes= new MergeResult(vbProjectParser,excelFileParser);
            SuccessButton.Enabled = true;
            VBTestButton.Enabled = true;
            ExcelButton.Enabled = true;
            MissmatchButton.Enabled = true;
        }
Example #3
0
        public MergeResult(VbProjParser vbProj, ExcelParser excelProj)
        {
            Success = new List<TestMerge>();
            UnmacthedContent = new List<TestMerge>();
            UnmacthedExcel = new List<TestCase>();
            UnmacthedVB = new List<TestCase>();

            // do mapping for excel
            PhysicalFileNameComparer comparer = new PhysicalFileNameComparer();
            foreach (var currrentExcel in excelProj.TestCases)
            {
                int indexTraverse = 0;
                string excelTestName = currrentExcel.TestName;
                while (indexTraverse < vbProj.TestCases.Count)
                {
                    TestCase currentVB = vbProj.TestCases[indexTraverse];
                    string vbTestName = PhysicalFileNameComparer.extractFileNameOnly(currentVB.TestPhysicalFileName);
                    int valo = string.Compare(excelTestName, vbTestName, false);

                    if (valo == 0)
                    {
                        currrentExcel.isMatch = true;
                        currentVB.isMatch = true;
                        TestMerge resultMerge =new TestMerge() { excelSource = currrentExcel, vbSource = currentVB };
                        if (resultMerge.isSame()){
                            Success.Add(resultMerge);
                        }
                        else {
                            UnmacthedContent.Add(resultMerge);
                        }
                        break;
                    }
                    if (valo < 0)
                    {
                        break;
                    }
                    indexTraverse++;
                }
            }
            excelProj.TestCases.RemoveAll(p => p.isMatch);
            UnmacthedExcel = excelProj.TestCases;

            vbProj.TestCases.RemoveAll(p => p.isMatch);
            UnmacthedVB= vbProj.TestCases;
        }