Esempio n. 1
0
        //Bootstrap helper function
        string CreateTableRow(BaseRecord record, ResultPrimarySecondary primarySecondary)
        {
            WeakHTMLTag tr = new WeakHTMLTag("tr");

            //If the conclusion is MAJOR or FATAL, add a class to the TR so the entire row is colored
            if ((record.Conclusion == ConclusionEnum.Major) || (record.Conclusion == ConclusionEnum.Fatal))
            {
                tr.CSSClass = ConclusionToCSSModifier(record.Conclusion);
            }

            //Add parameter for script details modal
            tr.Attributes["data-toggle"]        = "modal";
            tr.Attributes["data-target"]        = "#modalDetails";
            tr.Attributes["data-modal-title"]   = WeakHTMLTag.HTMLEncode(record.ScriptFilename);
            tr.Attributes["data-modal-content"] = ConvertProcessMessagesToHTML(record.ProcessMessages);

            //Create <td> for Status
            string tdStatus = CreateHTMLElement_TdGlyphSpan(record.Conclusion);

            //Create <td> for Name and Script file
            string tdName = CreateHTMLElement_TdTextSmallText(record.Name, record.ScriptFilename);

            string tdValue = CreateHTMLElement_TdTextSmallText(primarySecondary.Primary, primarySecondary.Secondary);

            tr.HTML = tdStatus + tdName + tdValue;

            return(tr.ToString() + "\r\n");
        }
Esempio n. 2
0
        //This needs to be called by the implementation to start the replacement process
        protected void StartGenerating(Report report)
        {
            ReplaceHeaderValuesInternal(report);

            ReplaceAssetStatisticsInternal(report);
            ReplaceTestStatisticsInternal(report);

            ReplaceResultTextInternal();
            ReplaceAssetConclusionTextInternal();
            ReplaceTestConclusionTextInternal();

            ReplaceTestRecommendedActionTextInternal();

            //Begin details replacement for assets
            StringBuilder sbAssets = new StringBuilder();

            StartAssetDetails(sbAssets);
            foreach (AssetRecord asset in report.Assets)
            {
                BaseRecord             baseRec = asset as BaseRecord;
                ResultPrimarySecondary rps     = new ResultPrimarySecondary(baseRec);

                ProcessAsset(sbAssets, asset, baseRec, rps);
            }
            EndAssetDetails(sbAssets);

            ReplaceAssetList("AssetRows".ToUpper(), sbAssets.ToString());


            //Begin details replacment for tests
            StringBuilder sbTests = new StringBuilder();

            StartTestDetails(sbTests);
            foreach (TestRecord test in report.Tests)
            {
                BaseRecord             baseRec = test as BaseRecord;
                ResultPrimarySecondary rps     = new ResultPrimarySecondary(baseRec);

                ProcessTest(sbTests, test, baseRec, rps);
            }
            EndTestDetails(sbAssets);

            ReplaceTestList("TestRows".ToUpper(), sbTests.ToString());
        }
Esempio n. 3
0
        string CreateRecordDetails(string tagName, BaseRecord record, ResultPrimarySecondary resultPrimSecond)
        {
            //Yes, this somewhat cheating....
            WeakHTMLTag tag = new WeakHTMLTag(tagName);

            WeakHTMLTag name = new WeakHTMLTag("Name");

            name.Text = record.Name;

            WeakHTMLTag filename = new WeakHTMLTag("Filename");

            filename.Text = record.ScriptFilename;

            WeakHTMLTag conclusion = new WeakHTMLTag("Conclusion");

            conclusion.Text = ((int)record.Conclusion).ToString();

            WeakHTMLTag conclusionString = new WeakHTMLTag("ConclusionString");

            conclusionString.Text = record.Conclusion.ToString();



            //Create sub tag "result"
            WeakHTMLTag primary = new WeakHTMLTag("Primary");

            primary.Text = resultPrimSecond.Primary;

            WeakHTMLTag secondary = new WeakHTMLTag("Secondary");

            secondary.Text = resultPrimSecond.Secondary;

            WeakHTMLTag result = new WeakHTMLTag("Result");

            result.HTML = primary.ToString() + secondary.ToString();


            //Construct the final XML
            tag.HTML = name.ToString() + filename.ToString() + conclusion.ToString() + conclusionString.ToString() + result.ToString();

            return(tag.ToString());
        }
Esempio n. 4
0
        private ItemDetail ConvertToItemDetail(BaseRecord baseRec)
        {
            ItemDetail detail = new ItemDetail();

            detail.Name             = baseRec.Name;
            detail.Filename         = baseRec.ScriptFilename;
            detail.Conclusion       = baseRec.Conclusion;
            detail.ConclusionString = baseRec.Conclusion.ToString();

            ResultPrimarySecondary rps = new ResultPrimarySecondary(baseRec);

            ItemResult result = new ItemResult();

            result.Primary  = rps.Primary;
            result.Seconday = rps.Secondary;

            detail.Result = result;

            return(detail);
        }
Esempio n. 5
0
 //Called by this class for each test that exists. Imlementation must add the content to the given stringbuilder.
 protected abstract void ProcessTest(StringBuilder sbTests, TestRecord test, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond);
Esempio n. 6
0
 //Called by this class for each asset that exists. Imlementation must add the content to the given stringbuilder.
 protected abstract void ProcessAsset(StringBuilder sbAssets, AssetRecord asset, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond);
Esempio n. 7
0
 protected override void ProcessTest(StringBuilder sbTests, TestRecord test, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond)
 {
     sbTests.AppendLine(CreateTableRow(baseRec, resultPrimSecond));
 }
Esempio n. 8
0
 protected override void ProcessAsset(StringBuilder sbAssets, AssetRecord asset, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond)
 {
     sbAssets.AppendLine(CreateTableRow(baseRec, resultPrimSecond));
 }
Esempio n. 9
0
        //Bootstrap helper function
        string CreateTableRow(BaseRecord record, ResultPrimarySecondary primarySecondary)
        {
            WeakHTMLTag tr = new WeakHTMLTag("tr");

            //If the conclusion is MAJOR or FATAL, add a class to the TR so the entire row is colored
            if ((record.Conclusion == ConclusionEnum.Major) || (record.Conclusion == ConclusionEnum.Fatal))
            {
                tr.CSSClass = ConclusionToCSSModifier(record.Conclusion);
            }

            //Add parameter for script details modal
            tr.Attributes["data-toggle"] = "modal";
            tr.Attributes["data-target"] = "#modalDetails";
            tr.Attributes["data-modal-title"] = WeakHTMLTag.HTMLEncode(record.ScriptFilename);
            tr.Attributes["data-modal-content"] = ConvertProcessMessagesToHTML(record.ProcessMessages);

            //Create <td> for Status
            string tdStatus = CreateHTMLElement_TdGlyphSpan(record.Conclusion);

            //Create <td> for Name and Script file
            string tdName = CreateHTMLElement_TdTextSmallText(record.Name, record.ScriptFilename);

            string tdValue = CreateHTMLElement_TdTextSmallText(primarySecondary.Primary, primarySecondary.Secondary);
            tr.HTML = tdStatus + tdName + tdValue;

            return tr.ToString() + "\r\n";
        }
Esempio n. 10
0
 protected override void ProcessTest(StringBuilder sbTests, TestRecord test, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond)
 {
     sbTests.AppendLine(CreateTableRow(baseRec, resultPrimSecond));
 }
Esempio n. 11
0
 protected override void ProcessAsset(StringBuilder sbAssets, AssetRecord asset, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond)
 {
     sbAssets.AppendLine(CreateTableRow(baseRec, resultPrimSecond));
 }
        //This needs to be called by the implementation to start the replacement process
        protected void StartGenerating(Report report)
        {
            ReplaceHeaderValuesInternal(report);

            ReplaceAssetStatisticsInternal(report);
            ReplaceTestStatisticsInternal(report);

            ReplaceResultTextInternal();
            ReplaceAssetConclusionTextInternal();
            ReplaceTestConclusionTextInternal();

            ReplaceTestRecommendedActionTextInternal();

            //Begin details replacement for assets
            StringBuilder sbAssets = new StringBuilder();

            StartAssetDetails(sbAssets);
            foreach (AssetRecord asset in report.Assets)
            {
                BaseRecord baseRec = asset as BaseRecord;
                ResultPrimarySecondary rps = new ResultPrimarySecondary(baseRec);

                ProcessAsset(sbAssets, asset, baseRec, rps);
            }
            EndAssetDetails(sbAssets);

            ReplaceAssetList("AssetRows".ToUpper(), sbAssets.ToString());

            //Begin details replacment for tests
            StringBuilder sbTests = new StringBuilder();

            StartTestDetails(sbTests);
            foreach (TestRecord test in report.Tests)
            {
                BaseRecord baseRec = test as BaseRecord;
                ResultPrimarySecondary rps = new ResultPrimarySecondary(baseRec);

                ProcessTest(sbTests, test, baseRec, rps);
            }
            EndTestDetails(sbAssets);

            ReplaceTestList("TestRows".ToUpper(), sbTests.ToString());
        }
 //Called by this class for each test that exists. Imlementation must add the content to the given stringbuilder.
 protected abstract void ProcessTest(StringBuilder sbTests, TestRecord test, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond);
 //Called by this class for each asset that exists. Imlementation must add the content to the given stringbuilder.
 protected abstract void ProcessAsset(StringBuilder sbAssets, AssetRecord asset, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond);