public void FormatsStatsCorrectly() { string expectedStatsXML = @"<name>name</name> <totalCrap>42.2</totalCrap> <crap>0.0</crap> <median>0.0</median> <average>0.0</average> <stdDev>0.0</stdDev> <methodCount>3</methodCount> <crapMethodCount>2</crapMethodCount> <crapMethodPercent>66.7</crapMethodPercent> <crapLoad>29</crapLoad> <crapThreshold>15</crapThreshold> <globalAverage>-1.0</globalAverage> <globalCraploadAverage>-1.0</globalCraploadAverage> <globalCrapMethodAverage>-1.0</globalCrapMethodAverage> <globalTotalMethodAverage>-1.0</globalTotalMethodAverage> <globalAverageDiff>0.0</globalAverageDiff> <globalCraploadAverageDiff>0.0</globalCraploadAverageDiff> <globalCrapMethodAverageDiff>0.0</globalCrapMethodAverageDiff> <globalTotalMethodAverageDiff>0.0</globalTotalMethodAverageDiff> <shareStatsUrl>http://www.crap4j.org/benchmark/stats/new?stat[project_hash]=1290006074016&amp;stat[project_url]=test&amp;stat[crap]=50.00&amp;stat[crap_load]=5&amp;stat[crap_methods]=1&amp;stat[total_methods]=2&amp;stat[ones]=0&amp;stat[twos]=1&amp;stat[fours]=0&amp;stat[eights]=0&amp;stat[sixteens]=1&amp;stat[thirtytwos]=0&amp;stat[sixtyfours]=0&amp;stat[one28s]=0&amp;stat[two56s]=0</shareStatsUrl> <histogram><hist><place>one</place><value>0</value><height>0.00px</height></hist></histogram> "; var formatter = new Crap4JXmlFormatter(); var xml = formatter.FormatReport(_crapMethods); AssertIsEqualWhiteSpaceInsensitive(expectedStatsXML, xml.SelectSingleNode("//stats").InnerXml); }
public void FormatsMethodDataCorrectly() { string expectedTest1XML = @"<package>type1</package> <className>type1</className> <methodName>method1</methodName> <methodSignature>()</methodSignature> <fullMethod>type1.method1</fullMethod> <crap>20.11</crap> <complexity>14</complexity> <coverage>27</coverage> <crapLoad>14</crapLoad> "; var formatter = new Crap4JXmlFormatter(); var xml = formatter.FormatReport(_crapMethods); AssertIsEqualWhiteSpaceInsensitive(expectedTest1XML, xml.SelectSingleNode("//methods/method").InnerXml); }