public void TestSample1()
        {
            // ROW1= APPLICATIONS,COL1=METRICS,METRICS=HEALTH_FACTOR, APPLICATIONS=EACH
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "APPLICATIONS" },
                { "METRICS", "HEALTH_FACTOR" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "Transferability", "Changeability", "Robustness", "Efficiency", "Security"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "3.07", "2.55", "3.32", "2.65", "3.30"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "2.97", "3.37", "3.68", "2.71", "3.73"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 3);
        }
        public void TestMetricsSeveralBCEachApp()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "APPLICATIONS" },
                { "METRICS", "60014|60017|60013" },
                { "AGGREGATORS", "AVERAGE" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "Efficiency", "Total Quality Index", "Robustness"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "2.65", "3.03", "3.32"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "2.71", "3.30", "3.68"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 3);
        }
        public void TestSample4()
        {
            // COL1=APPLICATIONS,ROW1=METRICS,METRICS=TECHNICAL_SIZING, APPLICATIONS=ALL,AGGREGATORS=SUM
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "APPLICATIONS" },
                { "ROW1", "METRICS" },
                { "METRICS", "TECHNICAL_SIZING" },
                { "AGGREGATORS", "SUM" },
                { "APPLICATIONS", "ALL" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Metrics", "2 Applications"
            });
            expectedData.AddRange(new List <string> {
                "Number of Code Lines", "67,589"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 2);
        }
        public void TestSample2()
        {
            // ROW1=APPLICATIONS, COL1=CRITICAL_VIOLATIONS,CRITICAL_VIOLATIONS =ALL,APPLICATIONS=EACH
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "CRITICAL_VIOLATIONS" },
                { "ROW1", "APPLICATIONS" },
                { "CRITICAL_VIOLATIONS", "ALL" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "Total Critical Violations", "Added Critical Violations", "Removed Critical Violations"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "41", "0", "33"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "80", "9", "174"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 3);
        }
        public void TestViolAppli()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "APPLICATIONS" },
                { "ROW1", "VIOLATIONS" },
                { "APPLICATIONS", "ReportGenerator" },
                { "VIOLATIONS", "ADDED|REMOVED" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Violations", "ReportGenerator"
            });
            expectedData.AddRange(new List <string> {
                "Added Violations", "1,691"
            });
            expectedData.AddRange(new List <string> {
                "Removed Violations", "241"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 3);
        }
        public void TestMetricsViolStats()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "APPLICATIONS" },
                { "METRICS", "VIOLATION|CRITICAL_VIOLATION" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "Number of violations to critical quality rules per KLOC (average)"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "1"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "2"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 3);
        }
        public void TestMetricsFuncWeightTechDebtEachApp()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "APPLICATIONS" },
                { "METRICS", "FUNCTIONAL_WEIGHT|TECHNICAL_DEBT" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "OMG-Compliant Automated Function Points", "Technical Debt"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "477", "420,178"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "13,732", "175,144"
            });
            TestUtility.AssertTableContent(table, expectedData, 3, 3);
        }
        public void TestMetricsHFPortfolio()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "APPLICATIONS" },
                { "METRICS", "HEALTH_FACTOR" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "Transferability", "Changeability", "Robustness", "Efficiency", "Security"
            });
            expectedData.AddRange(new List <string> {
                "2 Applications", "3.02", "2.96", "3.50", "2.68", "3.51"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 2);
        }
        public void TestMetricsSZBCPortfolio()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "APPLICATIONS" },
                { "ROW1", "METRICS" },
                { "METRICS", "60013|10151" },
                { "AGGREGATORS", "AVERAGE|SUM" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Metrics", "2 Applications"
            });
            expectedData.AddRange(new List <string> {
                "Robustness", "3.50"
            });
            expectedData.AddRange(new List <string> {
                "Number of Code Lines", "67,589"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 3);
        }
        public void TestSample5()
        {
            // COL1=TECHNOLOGIES,ROW1=METRICS,METRICS=10151|10107|10152|10154|10161,AGGREGATORS=SUM,TECHNOLOGIES=EACH
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            reportData.Applications[0].Technologies = new[] { ".NET" };
            reportData.Applications[1].Technologies = new[] { "JEE", "SQL Analyzer" };

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "TECHNOLOGIES" },
                { "ROW1", "METRICS" },
                { "METRICS", "10151|10152|10154|10161" },
                { "AGGREGATORS", "SUM" },
                { "TECHNOLOGIES", "EACH" }
            };

            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Metrics", ".NET", "JEE", "SQL Analyzer"
            });
            expectedData.AddRange(new List <string> {
                "Number of Code Lines", "29,486", "12,649", "25,454"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 2);
        }
        public void TestAppTechnosViolations()
        {
            // COL1=TECHNOLOGIES,ROW1=APPLICATIONS,TECHNOLOGIES=EACH,APPLICATIONS=EACH,METRICS=10151
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            reportData.Applications[0].Technologies = new[] { ".NET" };
            reportData.Applications[1].Technologies = new[] { "JEE", "SQL Analyzer" };

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "TECHNOLOGIES" },
                { "ROW1", "VIOLATIONS" },
                { "ROW11", "APPLICATIONS" },
                { "VIOLATIONS", "TOTAL" },
                { "TECHNOLOGIES", "EACH" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Violations", ".NET", "JEE", "SQL Analyzer"
            });
            expectedData.AddRange(new List <string> {
                "Total Violations", " ", " ", " "
            });
            expectedData.AddRange(new List <string> {
                "    ReportGenerator", "5,278", "n/a", "n/a"
            });
            expectedData.AddRange(new List <string> {
                "    AADAEDAdmin", "n/a", "3,615", "101"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 4);
        }
        public void TestSample6()
        {
            // COL1=METRICS,ROW1=TECHNOLOGIES,METRICS=HEALTH_FACTORS,TECHNOLOGIES=EACH
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            reportData.Applications[0].Technologies = new[] { ".NET" };
            reportData.Applications[1].Technologies = new[] { "JEE", "SQL Analyzer" };

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "TECHNOLOGIES" },
                { "METRICS", "HEALTH_FACTOR" },
                { "TECHNOLOGIES", "EACH" }
            };
            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Technologies", "Transferability", "Changeability", "Robustness", "Efficiency", "Security"
            });
            expectedData.AddRange(new List <string> {
                ".NET", "3.07", "2.55", "3.32", "2.65", "3.30"
            });
            expectedData.AddRange(new List <string> {
                "JEE", "2.98", "3.32", "3.66", "2.76", "3.71"
            });
            expectedData.AddRange(new List <string> {
                "SQL Analyzer", "3.74", "3.92", "3.86", "2.51", "4.00"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 4);
        }
        public void TestSample3()
        {
            // COL1=METRICS,ROW1=CRITICAL_VIOLATIONS,ROW11=APPLICATIONS,METRICS=HEALTH_FACTOR,CRITICAL_VIOLATIONS =ADDED,APPLICATIONS=EACH
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "CRITICAL_VIOLATIONS" },
                { "ROW11", "APPLICATIONS" },
                { "METRICS", "HEALTH_FACTOR" },
                { "CRITICAL_VIOLATIONS", "ADDED" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Critical Violations", "Transferability", "Changeability", "Robustness", "Efficiency", "Security"
            });
            expectedData.AddRange(new List <string> {
                "Added Critical Violations", " ", " ", " ", " ", " "
            });
            expectedData.AddRange(new List <string> {
                "    ReportGenerator", "0", "0", "0", "0", "0"
            });
            expectedData.AddRange(new List <string> {
                "    AADAEDAdmin", "0", "0", "0", "9", "0"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 4);
        }