<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Opgenorth.NET &#187; TDD</title>
	<atom:link href="http://www.opgenorth.net/tag/tdd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.opgenorth.net</link>
	<description>Mindless missives of a .NET developer from the North</description>
	<lastBuildDate>Sat, 28 Aug 2010 15:58:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Every Time you [Ignore] a Test, a Puppy Dies</title>
		<link>http://www.opgenorth.net/2009/02/20/every-time-you-ignore-a-test-a-puppy-dies/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=every-time-you-ignore-a-test-a-puppy-dies</link>
		<comments>http://www.opgenorth.net/2009/02/20/every-time-you-ignore-a-test-a-puppy-dies/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 15:08:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2009/02/20/every-time-you-ignore-a-test-a-puppy-dies/</guid>
		<description><![CDATA[If you using a unit testing framework such as NUnit, you&#8217;re no doubt familiar with the [Ignore] attribute.  (Note:  I haven&#8217;t used MbUnit in a while, but I&#8217;m pretty sure that all this applies there as well.) For those who aren&#8217;t, when you adorn your [Test] with this attribute, then your test runner should pay [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.opgenorth.net/wp-content/uploads/2010/03/image001_2.jpg"><img style="display: inline; border: 0px;" title="image001_2" src="http://www.opgenorth.net/wp-content/uploads/2010/03/image001_2_thumb.jpg" border="0" alt="image001_2" width="244" height="174" /></a></p>
<p>If you using a unit testing framework such as <a href="http://www.nunit.org">NUnit</a>, you&#8217;re no doubt familiar with the <a href="http://www.nunit.org/index.php?p=ignore&amp;r=2.4.8">[Ignore]</a> attribute.  (Note:  I haven&#8217;t used <a href="http://www.mbunit.com">MbUnit</a> in a while, but I&#8217;m pretty sure that all this applies there as well.) For those who aren&#8217;t, when you adorn your [Test] with this attribute, then your test runner should pay no heed to this particular [Test].  Instead of going green or red, your test turns up as yellow in your test runner. At first blush, this seems handy &#8211; rather than deleting a failing or broken test you can have it [Ignore]d, much like your typical computer geek at a high school dance before the punch get&#8217;s spiked. Now you can deal with the wayward test on your own time with the pesky failure cluttering up your CI build (you do have a CI build box set up, right?).</p>
<p>Please bear with me while I submit to you: This isn&#8217;t a good idea. This is a bad idea. An ugly idea. The kind of bad, ugly idea than even <a href="http://www.igloocoder.com">Belcham</a>-esque quantities of scotch couldn&#8217;t make pretty. Why? Well, the whole point to having a unit test is to <strong>test something</strong>. If your test is failing, that means something is broken.  You should be addressing the cause of the failure and dealing with the problem now. Covering up the failure with some attribute kind of defeats the purpose of having the unit test in the first place. I mean, really, if you had open, festering lesions on your skin would you just cover them up with a band-aid and pretend nothing was wrong?  Odds are you&#8217;d go to a doctor and get that checked out.</p>
<p>Alternately, perhaps the test isn&#8217;t valid anymore: your application has changed/evolved and the code that you were testing isn&#8217;t around anymore. Then, get rid of the test! Delete it from your test fixtures, and don&#8217;t look back.</p>
<p>Granted the world we live in is not black and while.  Sometimes we&#8217;re working on things, and we only want tests to run when it is explicitly asked to run.  To handle this scenario, <a href="http://www.nunit.org">NUnit</a> provides the <a href="http://www.nunit.org/index.php?p=explicit&amp;r=2.4.8">[Explicit]</a> attribute.  This is a kinder, more gentle kind of ignore.  This instructs <a href="http://www.nunit.org">NUnit</a> to only run the test when it is told to run the test.  If you add a comment to the attribute, then it helps those going through the build log understand why the test is being run.  However it is still possible to run the test if desired.</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 650px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">[Explicit("<span style="color: #8b0000;">This test takes a really really really long time to run so we don't want to run it in this test suite every time</span>")]
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">[Test]
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> My_very_important_test()
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">{
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">    <span style="color: #008000;">// Test valuable things here</span>
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">}</pre>
</pre>
<p>I know some people are going to protest my advice. So I will offer up this one last piece.  If you are going to [Ignore] a [Test] then please take advantage of the fact that you can add a comment to the Ignore which will show up when <a href="http://www.nunit.org">NUnit</a> ignores the test:</p>
<pre style="border: 1px solid #cecece; padding: 5px; overflow: auto; background-color: #fbfbfb; min-height: 40px; width: 650px;">
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">[Ignore("<span style="color: #8b0000;">This test is ignored as I wish to incur the wrath of Cthulhu (or his proxy)</span>")]
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">[Test]
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> My_very_important_test()
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">{
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">    <span style="color: #008000;">// Test valuable things here.</span>
</pre>
<pre style="margin: 0em; background-color: #fbfbfb; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;">}</pre>
</pre>
<p>Now when your CI server runs your unit tests, you will have a nice friendly message that will inform others as to why the test is not running.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2009/02/20/every-time-you-ignore-a-test-a-puppy-dies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TypeMock, TestDriven.NET, and Red Tests</title>
		<link>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=typemock-testdriven-net-and-red-tests</link>
		<comments>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 00:34:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests/</guid>
		<description><![CDATA[Lately I&#8217;ve been experimenting with TypeMock Isolator,&#160; and it&#8217;s new AAA syntax.&#160; For the past two years I&#8217;ve been a diehard Rhino.Mocks kind of guy, but figured that it&#8217;s time to check out other tools.&#160; Anyway, I had a situation where a unit test of mine was failing when I ran it with TestDriven.NET, but [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been experimenting with <a href="http://www.typemock.com/">TypeMock Isolator</a>,&#160; and it&#8217;s new AAA syntax.&#160; For the past two years I&#8217;ve been a diehard Rhino.Mocks kind of guy, but figured that it&#8217;s time to check out other tools.&#160; Anyway, I had a situation where a unit test of mine was failing when I ran it with <a href="http://www.testdriven.net/">TestDriven.NET</a>, but would pass when I ran it using the unit test runner in <a href="http://www.jetbrains.com/resharper">Resharper 4.1</a>.</p>
<p>Usually when I develop, I write individual tests and then run individually with TestDriven.NET and collectively with Resharper.&#160; In this case, as I was writing one unit test, it kept failing with TestDriven.NET.&#160; At first I thought it was just me being stupid (always a good place to start), and then I was worried that perhaps the documentation for TypeMock was to blame.&#160; So, I sent a email to Avi at TypeMock, mostly expecting confirmation of my stupidity.</p>
<p>Turns out the problem in this case was pretty obscure one (to me).&#160; At home, I do my development in a VM running Windows 2008 64 bit.&#160; When Resharper runs your unit tests, it does in a 32 bit process.&#160; TD.NET, on a 64bit OS,&#160; runs as a 64 bit process.&#160; If you get TD.NET to run as a 32 bit process, then your tests will run fine under TD.NET.</p>
<p>To do so, from the Visual Studio 2008 Command Prompt, change to the directory that you have TD.NET installed in.&#160; Then use corflags:</p>
<p><font face="Courier New">corflags /32bit+ ProcessInvocation.exe</font></p>
<p>Note that it&#8217;s probably best to do this when logged in as the Administrator.</p>
<p>I will say that I was happy with the support I got from the guys (Avi, Gil and Ohad) at TypeMock.&#160; Given the fact that we&#8217;re about a half a world apart (western Canada vs. Isreal), they provided prompt, excellent support.&#160; My thanks to them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TypeMock, TestDriven.NET, and Red Tests</title>
		<link>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests-2/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=typemock-testdriven-net-and-red-tests-2</link>
		<comments>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests-2/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 07:05:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests-2/</guid>
		<description><![CDATA[Lately I&#8217;ve been experimenting with TypeMock Isolator,&#160; and it&#8217;s new AAA syntax.&#160; For the past two years I&#8217;ve been a diehard Rhino.Mocks kind of guy, but figured that it&#8217;s time to check out other tools.&#160; Anyway, I had a situation where a unit test of mine was failing when I ran it with TestDriven.NET, but [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been experimenting with <a href="http://www.typemock.com/">TypeMock Isolator</a>,&#160; and it&#8217;s new AAA syntax.&#160; For the past two years I&#8217;ve been a diehard Rhino.Mocks kind of guy, but figured that it&#8217;s time to check out other tools.&#160; Anyway, I had a situation where a unit test of mine was failing when I ran it with <a href="http://www.testdriven.net/">TestDriven.NET</a>, but would pass when I ran it using the unit test runner in <a href="http://www.jetbrains.com/resharper">Resharper 4.1</a>.</p>
<p>Usually when I develop, I write individual tests and then run individually with TestDriven.NET and collectively with Resharper.&#160; In this case, as I was writing one unit test, it kept failing with TestDriven.NET.&#160; At first I thought it was just me being stupid (always a good place to start), and then I was worried that perhaps the documentation for TypeMock was to blame.&#160; So, I sent a email to Avi at TypeMock, mostly expecting confirmation of my stupidity. </p>
<p>Turns out the problem in this case was pretty obscure one (to me).&#160; At home, I do my development in a VM running Windows 2008 64 bit.&#160; When Resharper runs your unit tests, it does in a 32 bit process.&#160; TD.NET, on a 64bit OS,&#160; runs as a 64 bit process.&#160; If you get TD.NET to run as a 32 bit process, then your tests will run fine under TD.NET.</p>
<p>To do so, from the Visual Studio 2008 Command Prompt, change to the directory that you have TD.NET installed in.&#160; Then use corflags:</p>
<p>corflags /32bit+ ProcessInvocation.exe</p>
<p>Note that it&#8217;s probably best to do this when logged in as the Administrator.</p>
<p>I will say that I was happy with the support I got from the guys (Avi, Gil and Ohad) at TypeMock.&#160; Given the fact that we&#8217;re about a half a world apart (western Canada vs. Isreal), they provided prompt, excellent support.&#160; My thanks to them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unit Testing in JavaScript</title>
		<link>http://www.opgenorth.net/2008/08/16/unit-testing-in-javascript/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=unit-testing-in-javascript</link>
		<comments>http://www.opgenorth.net/2008/08/16/unit-testing-in-javascript/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 05:41:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/08/16/unit-testing-in-javascript/</guid>
		<description><![CDATA[Well, I don&#8217;t know why it&#8217;s taken me so long to get to get around to this: but I must say that there are now a couple of &#34;must haves&#34; in my web developer&#8217;s tool box.&#160; One of them is jQuery, and now the other is QUnit. Chad Myers has a good, quick, post introducing [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I don&#8217;t know why it&#8217;s taken me so long to get to get around to this: but I must say that there are now a couple of &quot;must haves&quot; in my web developer&#8217;s tool box.&#160; One of them is <a href="http://www.jquery.com">jQuery,</a> and now the other is <a href="http://docs.jquery.com/QUnit">QUnit</a>.</p>
<p><a href="http://www.lostechies.com/blogs/chad_myers/default.aspx">Chad Myers</a> has a good, quick, <a href="http://www.lostechies.com/blogs/chad_myers/archive/2008/08/28/getting-started-with-jquery-qunit-for-client-side-javascript-testing.aspx">post introducing QUnit</a>, I&#8217;d <em>strongly suggest</em> checking it out if you do web development (which, IMHO, implies some use of JavaScript, right?).&#160; Chad&#8217;s post covers the basics pretty good, and I think I would just be duplicating/plagiarizing Chad&#8217;s work if I were to blog the hour or two I spent getting to know QUnit here.</p>
<p>It is nice to see that JavaScript is slowly being recognized as first class citizen of the web programming world, and is gradually having it&#8217;s good name cleared of <a href="http://graysmatter.codivation.com/JavascriptRapedMyDogAndOtherFalsehoods.aspx">certain falsehoods</a>.&#160; It&#8217;s been my belief and observation for a while now that ASP.NET has done a pretty good job of stunting and retarding the adoption/use of JavaScript amongst .NET developers, at least in the Edmonton region.&#160; Good to see that this attitude is starting to change.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/08/16/unit-testing-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Much TDD is Enough?</title>
		<link>http://www.opgenorth.net/2008/08/06/how-much-tdd-is-enough/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-much-tdd-is-enough</link>
		<comments>http://www.opgenorth.net/2008/08/06/how-much-tdd-is-enough/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 21:16:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/08/06/how-much-tdd-is-enough/</guid>
		<description><![CDATA[At the last Edmonton Agile Methods User Group meeting, we had a brief discussion around code coverage, and what should be an acceptable number to shoot for.&#160; Is it okay when the unit tests cover 80% of the code?&#160; Or should 100% be the only acceptable value?&#160; After all, how can you be confident in [...]]]></description>
			<content:encoded><![CDATA[<p>At the last <a href="http://groups.google.com/group/eamug">Edmonton Agile Methods User Group</a> meeting, we had a brief discussion around <a href="http://en.wikipedia.org/wiki/Code_coverage">code coverage</a>, and what should be an acceptable number to shoot for.&#160; Is it okay when the unit tests cover 80% of the code?&#160; Or should 100% be the only acceptable value?&#160; After all, how can you be confident in your code knowing that 20% of it isn&#8217;t tested.</p>
<p>Allow me to go out on a limb here, and state with absolute certainty that the correct answer is &quot;It depends on your situation&quot;.&#160; Allow me to elaborate.</p>
<ol>
<li>The number sends a wrong message.&#160; If your team decides that they need some arbitrarily value to shoot for, that is what they will concentrate on.&#160; Developers will worry more about how many tests they need to write, rather than on the quality of their code. </li>
<li>Unit tests can suffer from the law of diminishing returns.&#160; To achieve that mythical number of 100% coverage would require a large amount of effort.&#160; I argue that in many cases, the high effort required drains away from the teams ability to keep delivering value in their software.&#160; In particular, exception testing comes to mind.&#160; You can spend a lot of time writing tests to cover parts of your code that, in theory, should never be executed. </li>
<li>Unit tests do not replace other forms of testing, so functionally speaking, you should still be covered.&#160; Sure, you may have some code that isn&#8217;t covered with a unit test, but hopefully your crack team of functional testers will exercise that code as part of their efforts.&#160; If your functional testers find a problem, and you don&#8217;t have a unit test that covers the code in question, then you will obviously write a test and fix the problem.&#160; If your functional testers don&#8217;t find a problem, then you don&#8217;t worry about it.&#160;
<ul>
<li>Remember that as a part of agile, you have short iterations with working software at the end of each iteration.&#160; So, if there is some problem code that is not tested, your users will find out about it fairly quickly.&#160; The power of rapid feedback at work. </li>
</ul>
</li>
<li>The test part of TDD is a useful side-effect. The true value of TDD is that it helps you craft out a better design for your code.&#160; If you ask me, TDD should stand for Test Driven Design, not Test Driven Development (I do believe credit for this observation belongs to <a href="http://weblogs.asp.net/rosherove/">Roy Osherove</a> &#8211; at least that is where I heard from first). </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/08/06/how-much-tdd-is-enough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where Should Your Tests Live?</title>
		<link>http://www.opgenorth.net/2008/04/10/where-should-your-tests-live/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=where-should-your-tests-live</link>
		<comments>http://www.opgenorth.net/2008/04/10/where-should-your-tests-live/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 23:25:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/04/10/where-should-your-tests-live/</guid>
		<description><![CDATA[Thanks to Phil Haack&#8216;s online poll, there is a bit of controversy over where one&#8217;s unit tests should reside:&#160; should the unit tests be housed in a separate project and assembly, or do they shack up in the same project as the code that they are testing?&#160; Like Bil, I figured that rather than a [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://haacked.com/Default.aspx">Phil Haack</a>&#8216;s <a href="http://haacked.com/archive/2008/04/09/unit-test-project-structure-poll.aspx">online poll</a>, there is a bit of controversy over where one&#8217;s unit tests should reside:&#160; should the unit tests be housed in a separate project and assembly, or do they shack up in the same project as the code that they are testing?&#160; Like <a href="http://weblogs.asp.net/bsimser/archive/2008/04/09/unit-test-projects-or-not.aspx">Bil</a>, I figured that rather than a big long blog comment, I&#8217;d be better of with my post.</p>
<p>Way back when I started out with TDD, I used to put the test fixtures in the same file as the class under test, sort of like:</p>
<pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> ClassUnderTest
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">{
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">}
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">#<span style="color: #0000ff">if</span> DEBUG
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">[TestFixture]
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Tests_for_ClassUnderTest
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">{
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">}
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">#endif</pre>
</pre>
<p>My logic was basically this way, the test is right there &#8211; quick and easy to access.&#160; Tests are, after all, supposed to serve as documentation, so by making the two classes share the same file, it was easy to find.&#160; Plus, if you changed your class, you had quick access to your tests. When it came time to deploy, you could just did a RELEASE build, and the unit tests would not be included.&#160; Or, if need be, send out the code with the unit tests included, and then your QA department could run your tests on their environment if desired.</p>
<p>However, I eventually moved away from this, for a couple of reasons:</p>
<p>I was still learning TDD, and I noticed I was doing a lot of thrashing.&#160; This was because my test code is right next to my production code and I found myself falling into a &quot;test last&quot; pattern.&#160; That is to say, I would write my code first, then my tests.&#160; When my code didn&#8217;t work, I&#8217;d change it, and then &quot;fix&quot; my test so that my code would work.&#160; I lacked the discipline and experience to write good, proper tests and I felt that part of the problem was it was to easy to fall back into the &quot;Old Ways&quot;.</p>
<p>I found that by putting my test classes in a separate assembly, I would actually think about what I need, and that would result in better tests and (IMHO) better code.&#160; After all, one of the real benefits about TDD is that it forces you to think about your design up front.&#160; I found that by using a separate assembly to house my unit tests, I ended up changing how I approached TDD.&#160; I spent a bit more time thinking about HOW my test would work, and HOW the code would be structured.&#160; It sounds crazy, but it worked for me.&#160; </p>
<p>In my experience, the good people in QA didn&#8217;t give two rips about our unit tests.&#160; They added no value to them, as they were using their own tests.&#160; So, if nobody cared to run the tests outside of the developers, there is no value in sending them out.&#160; Think lean here:&#160; no value, so no point to make the developer&#8217;s unit tests available.</p>
<p>Also, at the time, I didn&#8217;t like the idea that the code that was being deployed was the code that was being tested.&#160; I&#8217;m not a big fan of compile time directives, and compile time directives change your code.&#160; They always seemed to cause pain when you forgot one or misspelled it.&#160; Of course, now that we&#8217;re older, and using <a href="http://nant.sourceforge.net">Nant</a> zealously, this isn&#8217;t really an issue.</p>
<p>So, for those reasons, I changed the structure of my solutions.&#160; I briefly experimented with one test assembly per production assembly, but gave that up as to unwieldy.&#160; If you had a project with six assemblies, then you&#8217;d double it up with six test assemblies.&#160; Now when you wanted to run tests, you&#8217;d have 12 assemblies to compile and six to run the tests on.&#160; Not a lot of fun.&#160; Now imagine going onto a client site with 60 project solutions:&#160; it gets nasty fast.</p>
<p>I eventually settled down to the conventional &quot;&#8230;one test assembly to rule them all&#8230;&quot; approach, and have been doing that for a while.&#160; It seems to work well enough, and I never worried to much about the &quot;urban sprawl&quot; in my namespaces.&#160; Resharper makes it pretty easy to find classes and such, so if the namespace of my testing assembly didn&#8217;t quite match up with that of my application, I never considered it to be a big deal. </p>
<p>I was never really concerned about making a class public, or a method public to aid in testability.&#160; Most (all) applications I work on are basically in house line of business applications.&#160; I&#8217;m not writing frameworks or API&#8217;s to be consumed to the general public.&#160; The people that are using my classes can be trusted.&#160; Besides, they all had access to the code anyway, so what is to stop them from just going in and change the class/method from internal to public anyway?</p>
<p>So, where should your tests live?&#160; Really, I don&#8217;t think it matters.&#160; It seems natural to me to have a separate test project, but that is only because I&#8217;ve been doing it that way for a long time.&#160; I don&#8217;t really see anything wrong with putting your test fixtures in the same project as your production code.&#160; I&#8217;d think it was great that you had unit tests (something one rarely sees here in Edmonton), so if housing tests and production code in the same assembly works for you, then why not?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/04/10/where-should-your-tests-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unit Testing Data Access</title>
		<link>http://www.opgenorth.net/2007/09/24/unit-testing-data-access/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=unit-testing-data-access</link>
		<comments>http://www.opgenorth.net/2007/09/24/unit-testing-data-access/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 20:24:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2007/09/24/unit-testing-data-access/</guid>
		<description><![CDATA[One thing that I don&#8217;t like about writing tests is some of the jiggery-pokery that goes on with testing database access code. Jiggery-pokery being: ensuring the tables are there, up to date, and are holding the data that they are supposed to hold before and after the test has run. If you don&#8217;t pay attention [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that I don&#8217;t like about writing tests is some of the jiggery-pokery that goes on with testing database access code. Jiggery-pokery being: ensuring the tables are there, up to date, and are holding the data that they are supposed to hold before and after the test has run. If you don&#8217;t pay attention to these details, you get a lot of false negatives on your unit tests. This will result in a loss of confidence in your unit tests. When this happens you stop running them, and loose confidence in your ability to refactor without fear.</p>
<p>In my Petshop2Monorail side project I&#8217;m working on in my spare time, I decided to see about using an in-memory database for my tests. I would get <a href="http://www.castleproject.org/activerecord/">ActiveRecord</a> to create the database each and every time a test fixture runs. There may (or may not) be some activity involved with populating the database, but at least I have tight control over the database schema and the data I&#8217;m working with.</p>
<p>I checked out the <a href="http://www.sqlite.org/">SQLite</a> documentation, and in theory one should be able to use <a href="http://www.sqlite.org/">SQLite</a> as an in-memory database. I couldn&#8217;t get it to work. I&#8217;m not to sure if it&#8217;s something I&#8217;m doing wrong or if it&#8217;s a limitation of the <a href="http://sqlite.phxsoftware.com">ADO.NET data provider I&#8217;m using</a>. For now, I&#8217;m willing to turn a blind eye to this shortcoming, and use a file on disk. Yes, I am aware of some of SQLite&#8217;s other shortcomings (namely concurrency), but for the task at hand I don&#8217;t think that these shortcomings will negatively manifest themselves.&#160; Yes, I&#8217;m aware that I&#8217;m having a unit test use a file on disk (something I say you shouldn&#8217;t do).</p>
<p>The one glitch I ran into was with <a href="http://www.castleproject.org/activerecord">ActiveRecord</a>. I kept getting the error <em>The IDbCommand and IDbConnection implementation in the assembly SQLite.NET could not be found</em>. A quick bit of googling, and <a href="http://sqlite.phxsoftware.com/forums/t/564.aspx">I had my answer</a>. To summarize: There are two ADO.NET drivers for SQLite, and so therefore two NHibernate drivers: <a href="http://adodotnetsqlite.sourceforge.net/">NHibernate.Driver.SQLiteDriver</a> (old) and <a href="http://sqlite.phxsoftware.com/">NHibernate.Driver.SQLite20Driver</a> (new). NHibernate.Driver.SQLite20Driver is what I should have been using.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2007/09/24/unit-testing-data-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trying to Mock the Unmockable</title>
		<link>http://www.opgenorth.net/2007/06/19/trying-to-mock-the-unmockable/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=trying-to-mock-the-unmockable</link>
		<comments>http://www.opgenorth.net/2007/06/19/trying-to-mock-the-unmockable/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 17:04:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2007/05/08/trying-to-mock-the-unmockable/</guid>
		<description><![CDATA[(or, DataRowView How I Hate Thee) Recently I had to enhance an ASP.NET 2.0 GridView on a Web Form.&#160; Basically, the idea is that, if a certain field in the grid was false, I would strike-through all the text in that row.&#160; It seems simple enough: just use the RowDataBound event of the GridView control [...]]]></description>
			<content:encoded><![CDATA[<p>(or, <em>DataRowView How I Hate Thee</em>)     <br />Recently I had to enhance an ASP.NET 2.0 <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx">GridView</a> on a Web Form.&#160; Basically, the idea is that, if a certain field in the grid was false, I would strike-through all the text in that row.&#160; It seems simple enough: just use the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx">RowDataBound</a> event of the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx">GridView</a> control and&#160; apply the formating.&#160; Wanting to make this as testable as possible, I thought that perhaps some sort of decorator class would do the trick, something like: </p>
<pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">myGridView.RowDataBound +=
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">delegate</span>(<span style="color: #0000ff">object</span> sender, GridRowEventArgs rowEventArgs)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        InventoryPartVendorGridRowDecorator gridRowDecorator =
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #0000ff">new</span> InventoryPartVendorGridRowDecorator(rowEventArgs.Row);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        gridRowDecorator.Decorate();
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    }; </pre>
</pre>
<p>Then, using the dynamic duo of <a href="http://www.nunit.org">NUnit</a> and <a href="http://www.ayende.com/projects/rhino-mocks.aspx">Rhino.Mocks</a>, I would be able to test my decorator class independent of my web application.&#160; I thought I could mock out the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridviewrow.aspx">GridViewRow</a> and a <a href="http://msdn2.microsoft.com/en-us/library/system.data.datarowview.aspx">DataRowView</a>, and be on my merry way.&#160; Life would be good.&#160; And it would have been, until the wretched <a href="http://msdn2.microsoft.com/en-us/library/system.data.datarowview.aspx">DataRowView</a> entered into the picture. </p>
<p><a href="http://msdn2.microsoft.com/en-us/library/system.data.datarowview.aspx">DataRowView</a> sits pretty high up on the inheritance tree, doesn&#8217;t have any interfaces that are meaning full in this context, and it&#8217;s constructors are internal.&#160; So, it proved to be pretty difficult to mock.&#160; <br />To explain what I did, I will first show you my unit test: </p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">[Test]
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Decorate_InactiveVendor_TextDecorationLineThrough()
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">{
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    MockRepository mockery = <span style="color: #0000ff">new</span> MockRepository();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    GridViewRow mockGridViewRow = mockery.CreateMock&lt;GridViewRow&gt;(1, 1, DataControlRowType.DataRow, DataControlRowState.Normal);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    Hashtable dataRowViewDataItem = <span style="color: #0000ff">new</span> Hashtable(1);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    dataRowViewDataItem.Add(&quot;<span style="color: #8b0000">Active</span>&quot;, <span style="color: #0000ff">false</span>);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">using</span> (mockery.Record())
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        Expect.Call(mockGridViewRow.RowType)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            .Return(DataControlRowType.DataRow)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            .Repeat.Once();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        Expect.Call(mockGridViewRow.DataItem)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            .Return(dataRowViewDataItem)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            .Repeat.Once();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        mockGridViewRow.Style
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            .Add(HtmlTextWriterStyle.TextDecoration, &quot;<span style="color: #8b0000">line-through</span>&quot;);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">using</span> (mockery.Playback())
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        InventoryPartVendorGridRowDecorator gridRowDecorator =
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">            <span style="color: #0000ff">new</span> InventoryPartVendorGridRowDecorator(mockGridViewRow);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        gridRowDecorator.Decorate();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">} </pre>
</pre>
<p>
  <br />Notice what I did; I created a Hashtable and have my mockGridViewRow.DataItem return that.&#160; In otherwords, I&#8217;m not mocking DataRowView at all, I just cut it out of the picture.&#160; Then inside inside my InventoryPartVendorGridRowDecorator class I had to put this method: </p>
<p></p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> IsVendorActive()
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">{
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">object</span> val;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">object</span> dataItem = _row.DataItem;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #008000">// HACK [TO070508@1149] Because we can't mock DataRowView, we do this. </span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">if</span> (dataItem <span style="color: #0000ff">is</span> DataRowView)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        val = ((DataRowView) dataItem)[ActiveColumnName];
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">else</span> <span style="color: #0000ff">if</span> (dataItem <span style="color: #0000ff">is</span> IDictionary)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        val = ((IDictionary) dataItem)[ActiveColumnName];
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">else</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        val = <span style="color: #0000ff">null</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">if</span> (val == <span style="color: #0000ff">null</span>)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> NullReferenceException(&quot;<span style="color: #8b0000">Could not find the field 'Active'.</span>&quot;);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">return</span> TypeHelper.ConvertToBoolean(val, <span style="color: #0000ff">true</span>);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">} </pre>
</pre>
<p>
  <br />As you can see, what I ended up doing was sticking in a little &quot;adapter&quot; into my decorator.&#160; Not pretty, but it works. </p>
<p>What would others do in this situation?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2007/06/19/trying-to-mock-the-unmockable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
