public void TestOrderByDegradationVariation()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\PreviousBCTC.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1", previousDate);

            reportData = TestUtility.AddCriticalRuleViolations(reportData, 60011, @".\Data\cc60011.json", @".\Data\cc60011previous.json");
            reportData = TestUtility.AddNonCriticalRuleViolations(reportData, 60011, @".\Data\nc60011.json", @".\Data\nc60011previous.json");

            var component = new CastReporting.Reporting.Block.Table.RuleImprovementOpportunity();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "60011" },
                { "COUNT", "3" },
                { "C", "2" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Rule Name", "Current Violations", "Previous Violations", "Evolution", "Grade", "Grade Evolution"
            });
            expectedData.AddRange(new List <string> {
                "Avoid hiding static Methods", "63", "3", "+2,000 %", "1.56", "-52 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 2);
        }
Esempio n. 2
0
        public void TestLimitCount()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\PreviousBCTC.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1", previousDate);

            reportData = TestUtility.AddCriticalRuleViolations(reportData, 60011, @".\Data\cc60011.json", @".\Data\cc60011previous.json");
            reportData = TestUtility.AddNonCriticalRuleViolations(reportData, 60011, @".\Data\nc60011.json", @".\Data\nc60011previous.json");

            var component = new CastReporting.Reporting.Block.Table.TopNonCriticalViolations();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "60011" },
                { "COUNT", "1" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Rule Name", "# Violations"
            });
            expectedData.AddRange(new List <string> {
                "Avoid unreferenced Tables", "209"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 2);
        }
Esempio n. 3
0
        public void TestContent()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            reportData = TestUtility.AddCriticalRuleViolations(reportData, 60011, @".\Data\cc60011.json", null);
            reportData.RuleExplorer = new RuleBLLStub();

            var component = new CastReporting.Reporting.Block.Table.RulesDescriptionsOfTopCriticalViolations();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "60011" },
                { "IDX", "0" },
                { "COUNT", "2" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Rules Descriptions for Top Critical Violation Rules For Business Criterion Transferability", null
            });
            expectedData.AddRange(new List <string> {
                "Rule Name", "Avoid hiding static Methods"
            });
            expectedData.AddRange(new List <string> {
                "Rationale", "Hiding is all about polymorphism. This means that the OO designer expects to override methods and use polymorphism so that code calling methods through a base class will end up executing different methods depending on the instance being used. This is not the case with static methods. When static methods are called, there is no polymorphism in play. It is always the static method of the type used to reference the object used that is called. Hiding static methods is a misuse of OO practices that results in misunderstanding of what is going to be executed at runtime and thus leads to unexpected behavior, jeopardizing the stability of the application."
            });
            expectedData.AddRange(new List <string> {
                "Description", "Hiding Static Methods is not allowed. This Quality Rule retrieves all static methods that are redefined in subclasses i.e. \"implicitly hidden\". A Static Method MyMethod of Class MySuperClass is \"implicitly hidden\" in Subclass MySubClass if MySubClass contains a similar declaration of MyMethod (i.e. same signature)."
            });
            expectedData.AddRange(new List <string> {
                "Remediation", "Review the design of the Method"
            });
            expectedData.AddRange(new List <string> {
                "# Violations", "63"
            });
            expectedData.AddRange(new List <string> {
                " ", " "
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 15);
        }
Esempio n. 4
0
        public void TestContent()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\RuleListBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            reportData.RuleExplorer    = new RuleBLLStub();
            reportData.CurrentSnapshot = TestUtility.AddSameTechCritRulesViolations(reportData.CurrentSnapshot, @".\Data\TechCrit61009Violations.json");
            reportData = TestUtility.AddCriticalRuleViolations(reportData, 60011, @".\Data\cc60011.json", null);
            reportData = TestUtility.AddNonCriticalRuleViolations(reportData, 60011, @".\Data\nc60011.json", null);


            var component = new TechnicalCriteriaRules();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "BZID", "60011" },
                { "TCID", "61009" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Rule Name", "Description", "# Violations"
            });
            expectedData.AddRange(new List <string> {
                "Avoid hiding static Methods", "Hiding Static Methods is not allowed. This Quality Rule retrieves all static methods that are redefined in subclasses i.e. \"implicitly hidden\". A Static Method MyMethod of Class MySuperClass is \"implicitly hidden\" in Subclass MySubClass if MySubClass contains a similar declaration of MyMethod (i.e. same signature).", "124"
            });
            expectedData.AddRange(new List <string> {
                "Avoid accessing data by using the position and length", "This rule searches for Cobol programs accessing part of data by using a position and a length.", "123"
            });
            expectedData.AddRange(new List <string> {
                "Action Mappings should have few forwards", "All Action Mappings with more than 5 forward will be listed.", "58"
            });
            expectedData.AddRange(new List <string> {
                "Avoid unreferenced Tables", "List of schema tables that are not called", "58"
            });
            expectedData.AddRange(new List <string> {
                "Avoid Artifacts with High Cyclomatic Complexity", "Retrieves all Artifacts having a Cyclomatic Complexity greater than the specified threshold . Cyclomatic Complexity is a measure of the complexity of the control structure of an Artifact. It is the number of linearly independent paths and therefore, the minimum number of independent paths when executing the software. \nThe threshold is a parameter and can be changed at will.", "35"
            });
            TestUtility.AssertTableContent(table, expectedData, 3, 6);
        }
        public void TestOrderByImprovmentVariation()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\PreviousBCTC.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1", previousDate);

            reportData = TestUtility.AddCriticalRuleViolations(reportData, 60011, @".\Data\cc60011.json", @".\Data\cc60011previous.json");
            reportData = TestUtility.AddNonCriticalRuleViolations(reportData, 60011, @".\Data\nc60011.json", @".\Data\nc60011previous.json");

            var component = new CastReporting.Reporting.Block.Table.RuleImprovementOpportunity();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "60011" },
                { "COUNT", "3" },
                { "C", "1" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Rule Name", "Current Violations", "Previous Violations", "Evolution", "Grade", "Grade Evolution"
            });
            expectedData.AddRange(new List <string> {
                "Avoid unreferenced Tables", "209", "128", "+63.3 %", "1.69", "+26.7 %"
            });
            expectedData.AddRange(new List <string> {
                "Suspicious similar method names or signatures in an inheritance tree", "13", "0", "n/a", "4.00", "0 %"
            });
            expectedData.AddRange(new List <string> {
                "Avoid using untyped DataSet", "4", "6", "-33.3 %", "1.00", "0 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 4);
        }
        public void TestContent()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\PreviousBCTC.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1", previousDate);

            reportData = TestUtility.AddCriticalRuleViolations(reportData, 60011, @".\Data\cc60011.json", @".\Data\cc60011previous.json");
            reportData = TestUtility.AddNonCriticalRuleViolations(reportData, 60011, @".\Data\nc60011.json", @".\Data\nc60011previous.json");

            var component = new CastReporting.Reporting.Block.Table.TopCriticalViolations();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "60011" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Rule Name", "# Violations"
            });
            expectedData.AddRange(new List <string> {
                "Avoid hiding static Methods", "63"
            });
            expectedData.AddRange(new List <string> {
                "Suspicious similar method names or signatures in an inheritance tree", "13"
            });
            expectedData.AddRange(new List <string> {
                "Avoid using untyped DataSet", "4"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 4);
        }
Esempio n. 7
0
        public void TestLimitCount()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\RuleListBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            reportData.RuleExplorer    = new RuleBLLStub();
            reportData.CurrentSnapshot = TestUtility.AddSameTechCritRulesViolations(reportData.CurrentSnapshot, @".\Data\TechCrit61009Violations.json");
            reportData = TestUtility.AddCriticalRuleViolations(reportData, 60011, @".\Data\cc60011.json", null);
            reportData = TestUtility.AddNonCriticalRuleViolations(reportData, 60011, @".\Data\nc60011.json", null);

            var component = new TechnicalCriteriaRules();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "BZID", "60011" },
                { "TCID", "61009" },
                { "CNT", "2" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Rule Name", "Description", "# Violations"
            });
            expectedData.AddRange(new List <string> {
                "Avoid hiding static Methods", "Hiding Static Methods is not allowed. This Quality Rule retrieves all static methods that are redefined in subclasses i.e. \"implicitly hidden\". A Static Method MyMethod of Class MySuperClass is \"implicitly hidden\" in Subclass MySubClass if MySubClass contains a similar declaration of MyMethod (i.e. same signature).", "124"
            });
            expectedData.AddRange(new List <string> {
                "Avoid accessing data by using the position and length", "This rule searches for Cobol programs accessing part of data by using a position and a length.", "123"
            });
            TestUtility.AssertTableContent(table, expectedData, 3, 3);
        }