<?xml version="1.0" encoding="utf-8"?>
<!-- 
XSLT Schema for generating build reports for CCNet Dashboard from unit test report generated by MSTest utility (v. 8.0.50727.26)
Author: Roman V. Gavrilov (clavrg@hotmail.com)
Modified by Robert Hancock (roberth@blackmarble.co.uk) for use with Visual Studio 2008 (MSTest V9.x)
-->

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a ="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">

	<xsl:param name="today"></xsl:param>

	<xsl:param name="results"></xsl:param>

	<xsl:param name="pass" select='Passed'/>

	<xsl:param name="fail" select="Failed"/>

	<xsl:template match="/">

		<html>

			<body style="font-family:Verdana; font-size:10pt">

				<table style="font-family:Verdana; font-size:10pt">

				</table>

				<xsl:call-template name="summary" />

				<xsl:call-template name="details" />

			</body>

		</html>

	</xsl:template>

	<xsl:template name="summary">

		<table class="section-table" cellpadding="2" cellspacing="0" border="0" width="98%">
			<tr>
				<td class="sectionheader" colspan="2">
					Tests run: <xsl:value-of select="count(//a:UnitTestResult/@outcome)"/>
					Pass:  <xsl:value-of select="count(//a:UnitTestResult/@outcome[.='Passed'])"/>
					Fail:  <xsl:value-of select="count(//a:UnitTestResult/@outcome[.='Failed'])" />
				</td>
			</tr>
		</table>


		<h3>Test Summary</h3>

		<table style="width:640;border:1px solid black;font-family:Verdana; font-size:10pt">

			<tr>

				<td style="font-weight:bold">Total</td>

				<td style="font-weight:bold">Failed</td>

				<td style="font-weight:bold">Passed</td>

				<td style="font-weight:bold">Test Not Run</td>

			</tr>

			<tr>

				<td >
					<xsl:value-of select="count(//a:UnitTestResult/@outcome)"/>
				</td>

				<td style="background-color:pink;">
					<xsl:value-of select="count(//a:UnitTestResult/@outcome[.='Failed'])"/>
				</td>

				<td style="background-color:lightgreen;">
					<xsl:value-of select="count(//a:UnitTestResult/@outcome[.='Passed'])"/>
				</td>

				<td style="background-color:yellow;">
					<xsl:value-of select="count(//a:UnitTestResult/@outcome[.!='Passed' and .!='Failed'])"/>
				</td>

			</tr>

		</table>

	</xsl:template>

	<xsl:template name="details">

		<h3>Unit Test Results</h3>

		<table style="width:640;border:1px solid black;font-family:Verdana; font-size:10pt;">

			<tr>

				<td style="font-weight:bold">Test Name</td>

				<td style="font-weight:bold">Result</td>

				<td style="font-weight:bold">Message</td>

			</tr>



			<xsl:for-each select="//a:UnitTestResult">
				<xsl:if test="contains(@outcome, 'Failed')">
					<tr>

						<xsl:attribute name="style">

							<xsl:choose>

								<xsl:when test="contains(@outcome, 'Failed')">background-color:pink;</xsl:when>


							</xsl:choose>


						</xsl:attribute>


						<td>

							<xsl:value-of select="@testName"/>

						</td>

						<td>

							<xsl:if test="contains(@outcome, 'Failed')">

								<xsl:choose>

									<xsl:when test="contains(@outcome, 'Failed')">FAILED</xsl:when>

								</xsl:choose>

							</xsl:if>

						</td>


						<td>

							<xsl:value-of select="node()" />


						</td>


					</tr>

				</xsl:if>

			</xsl:for-each>


		</table>

	</xsl:template>


</xsl:stylesheet>

