/// <summary> /// Generates a table with specification coverage statistics /// </summary> /// <param name="aDictionary">The model</param> /// <param name="coveredParagraphs">Number and percentage of covered paragraphs</param> /// <param name="nonCoveredParagraphs">Number and percentage of non covered paragraphs</param> /// <param name="applicableParagraphs">Number of applicable paragraphs</param> /// <param name="allParagraphs">Total number of paragraphs</param> /// <returns></returns> private void GenerateStatistics(Dictionary aDictionary, bool coveredParagraphs, bool nonCoveredParagraphs, bool applicableParagraphs, bool allParagraphs) { AddSubParagraph("Statistics"); AddTable(new string[] {"", "Value"}, new int[] {70, 70}); if (allParagraphs) { AddRow("Total number of paragraphs", aDictionary.AllParagraphs.Count.ToString()); } if (applicableParagraphs) { AddRow("Number of applicable paragraphs", aDictionary.ApplicableParagraphs.Count.ToString()); } double applicableParagraphsCount = aDictionary.ApplicableParagraphs.Count; double coveredParagraphsCount = aDictionary.CoveredRequirements().Count; double coveredPercentage = (coveredParagraphsCount/applicableParagraphsCount)*100; double nonCoveredParagraphsCount = applicableParagraphsCount - coveredParagraphsCount; double nonCoveredPercentage = 100 - coveredPercentage; if (coveredParagraphs) { AddRow("Number of covered requirements", String.Format("{0} ({1:0.##}%)", coveredParagraphsCount, coveredPercentage)); } if (nonCoveredParagraphs) { AddRow("Number of non covered requirements", String.Format("{0} ({1:0.##}%)", nonCoveredParagraphsCount, nonCoveredPercentage)); } CloseSubParagraph(); }