Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

A Money type for the CLR

, 18 Mar 2013 Ms-PL
A convenient, high-performance money structure for the CLR which handles arithmetic operations, currency types, formatting, and careful distribution and rounding without loss.
moneytype.zip
Money
lib
xunit.console.clr4.exe
xunit.console.clr4.pdb
xunit.console.clr4.x86.exe
xunit.console.clr4.x86.pdb
xunit.console.exe
xunit.console.pdb
xunit.console.x86.exe
xunit.console.x86.pdb
xunit.dll
xunit.dll.tdnet
xunit.extensions.dll
xunit.extensions.pdb
xunit.gui.clr4.exe
xunit.gui.clr4.pdb
xunit.gui.clr4.x86.exe
xunit.gui.clr4.x86.pdb
xunit.gui.exe
xunit.gui.pdb
xunit.gui.x86.exe
xunit.gui.x86.pdb
xunit.installer.exe
xunit.installer.pdb
xunit.pdb
xunit.runner.msbuild.dll
xunit.runner.msbuild.pdb
xunit.runner.tdnet.dll
xunit.runner.tdnet.pdb
xunit.runner.utility.dll
xunit.runner.utility.pdb
xunitext.dll
xunitext.nunit.dll
xunitext.runner.jetbrains.dll
xunitext.runner.msbuild.dll
xunitext.runner.tdnet.dll
xunitext35.dll
src
Money
Money.sln.DotSettings.user
Money.Tests
bin
Debug
Money.dll
Money.pdb
Money.Tests.dll
Money.Tests.pdb
xunit.dll
xunit.pdb
obj
Debug
DesignTimeResolveAssemblyReferencesInput.cache
Money.Tests.csprojResolveAssemblyReference.cache
Money.Tests.dll
Money.Tests.pdb
TempPE
Properties
Money.v11.suo
bin
Debug
Money.dll
Money.pdb
obj
Debug
DesignTimeResolveAssemblyReferencesInput.cache
Money.csprojResolveAssemblyReference.cache
Money.dll
Money.pdb
TempPE
Properties
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html"/>
    <xsl:template match="/">
        <xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">]]></xsl:text>
        <html>
            <head>
                <title>
                    xUnit.net Test Results - <xsl:value-of select="@name"/>
                </title>
                <style type="text/css">
                    body { font-family: Calibri, Verdana, Arial, sans-serif; background-color: White; color: Black; }
                    h2,h3,h4,h5 { margin: 0; padding: 0; }
                    h3 { font-weight: normal; }
                    h5 { font-weight: normal; font-style: italic; margin-bottom: 0.75em; }
                    pre { font-family: Consolas; font-size: 85%; margin: 0 0 0 1em; padding: 0; }
                    .divided { border-top: solid 1px #f0f5fa; padding-top: 0.5em; }
                    .row, .altrow { padding: 0.1em 0.3em; }
                    .row { background-color: #f0f5fa; }
                    .altrow { background-color: #e1ebf4; }
                    .success, .failure, .skipped { font-family: Arial Unicode MS; font-weight: normal; float: left; width: 1em; display: block; }
                    .success { color: #0c0; }
                    .failure { color: #c00; }
                    .skipped { color: #cc0; }
                    .timing { float: right; }
                    .indent { margin: 0.25em 0 0.5em 2em; }
                    .clickable { cursor: pointer; }
                    .testcount { font-size: 85%; }
                </style>
                <script language="javascript">
                    function ToggleClass(id) {
                        var elem = document.getElementById(id);
                        if (elem.style.display == "none") {
                            elem.style.display = "block";
                        }
                        else {
                            elem.style.display = "none";
                        }
                    }
                </script>
            </head>
            <body>
                <xsl:apply-templates/>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="assemblies">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="assembly">
        <h3 class="divided"><b>Results for <xsl:value-of select="@name"/></b></h3>
        <div>
            Tests run: <a href="#all"><b><xsl:value-of select="@total"/></b></a> &#160;
            Failures: <a href="#failures"><b><xsl:value-of select="@failed"/></b></a>,
            Skipped: <a href="#skipped"><b><xsl:value-of select="@skipped"/></b></a>,
            Run time: <b><xsl:value-of select="@time"/>s</b>
        </div>
        <xsl:if test="class/test[@result='Fail']">
            <br />
            <h2><a name="failures"></a>Failed tests</h2>
            <xsl:apply-templates select="class/test[@result='Fail']"><xsl:sort select="@name"/></xsl:apply-templates>
        </xsl:if>
        <xsl:if test="class/failure">
            <br />
            <h2><a name="failures"></a>Failed fixtures</h2>
            <xsl:apply-templates select="class/failure"><xsl:sort select="../@name"/></xsl:apply-templates>
        </xsl:if>
        <xsl:if test="@skipped > 0">
            <br />
            <h2><a name="skipped"></a>Skipped tests</h2>
            <xsl:apply-templates select="class/test[@result='Skip']"><xsl:sort select="@name"/></xsl:apply-templates>
        </xsl:if>
        <br />
        <h2><a name="all"></a>All tests</h2>
        <h5>Click test class name to expand/collapse test details</h5>
        <xsl:apply-templates select="class"><xsl:sort select="@name"/></xsl:apply-templates>
        <br /><h5>Results generated <xsl:value-of select="@run-date"/> at <xsl:value-of select="@run-time"/></h5>
    </xsl:template>

    <xsl:template match="test">
        <div>
            <xsl:attribute name="class"><xsl:if test="(position() mod 2 = 0)">alt</xsl:if>row</xsl:attribute>
            <xsl:if test="@result!='Skip'"><span class="timing"><xsl:value-of select="@time"/>s</span></xsl:if>
            <xsl:if test="@result='Skip'"><span class="timing">Skipped</span><span class="skipped">&#x2762;</span></xsl:if>
            <xsl:if test="@result='Fail'"><span class="failure">&#x2718;</span></xsl:if>
            <xsl:if test="@result='Pass'"><span class="success">&#x2714;</span></xsl:if>
            &#160;<xsl:value-of select="@name"/>
            <xsl:if test="child::node()/message"> : <xsl:value-of select="child::node()/message"/></xsl:if>
            <br clear="all" />
            <xsl:if test="failure/stack-trace">
                <pre><xsl:value-of select="failure/stack-trace"/></pre>
            </xsl:if>
            <xsl:if test="output">
                <h4>Output</h4>
                <pre><xsl:value-of select="output"/></pre>
            </xsl:if>
        </div>
    </xsl:template>

    <xsl:template match="failure">
        <span class="failure">&#x2718;</span> <xsl:value-of select="../@name"/> : <xsl:value-of select="message"/><br clear="all"/>
        Stack Trace:<br />
        <pre><xsl:value-of select="stack-trace"/></pre>
    </xsl:template>

    <xsl:template match="class">
        <h3>
            <span class="timing"><xsl:value-of select="@time"/>s</span>
            <span class="clickable">
                <xsl:attribute name="onclick">ToggleClass('class<xsl:value-of select="position()"/>')</xsl:attribute>
                <xsl:attribute name="ondblclick">ToggleClass('class<xsl:value-of select="position()"/>')</xsl:attribute>
                <xsl:if test="@failed > 0"><span class="failure">&#x2718;</span></xsl:if>
                <xsl:if test="@failed = 0"><span class="success">&#x2714;</span></xsl:if>
                &#160;<xsl:value-of select="@name"/>
                &#160;<span class="testcount">(<xsl:value-of select="@total"/>&#160;test<xsl:if test="@total > 1">s</xsl:if>)</span>
            </span>
            <br clear="all" />
        </h3>
        <div class="indent">
            <xsl:if test="@failed = 0"><xsl:attribute name="style">display: none;</xsl:attribute></xsl:if>
            <xsl:attribute name="id">class<xsl:value-of select="position()"/></xsl:attribute>
            <xsl:apply-templates select="test"><xsl:sort select="@name"/></xsl:apply-templates>
        </div>
    </xsl:template>

</xsl:stylesheet>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Share

About the Author

codekaizen
Architect
United States United States
I'm a software engineer with 25 years of experience in areas from game and simulation development, enterprise development, systems management, machine learning, real-time and embedded systems development and geospaitial systems development.
 
You can find more of my work at http://www.codeplex.com and my articles at http://vectordotnet.blogspot.com/ and http://dotnoted.spaces.live.com.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 18 Mar 2013
Article Copyright 2008 by codekaizen
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid