<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:posterous="http://posterous.com/help/rss/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
  <channel>
    <title>graemef.com</title>
    <link>http://graemef.com</link>
    <description>A collection of *really long* tweets by @GraemeF</description>
    <generator>posterous.com</generator>
    <link xmlns="http://www.w3.org/2005/Atom" href="http://posterous.com/api/sup_update#906c63d7a" type="application/json" rel="http://api.friendfeed.com/2008/03#sup" />
    
    
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/GraemeFPosts" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="graemefposts" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://posterous.superfeedr.com/" /><item>
      <pubDate>Thu, 17 Feb 2011 04:39:00 -0800</pubDate>
      <title>Framework switcheroo</title>
      <link>http://graemef.com/framework-switcheroo</link>
      <guid>http://graemef.com/framework-switcheroo</guid>
      <description>
        <![CDATA[<p>
	<p>Following on from my <a href="http://graemef.com/42600017">mocking framework comparison</a>, I changed <a href="https://github.com/GraemeF/Twiddler">Twiddler</a> (my pet Twitter client project) from <a href="http://moq.me">Moq</a> to <a href="http://nsubstitute.github.com/">NSubstitute</a>, and from <a href="http://xunit.codeplex.com/">xUnit.net</a>'s built-in Asserts to <a href="http://should.codeplex.com/">Should.Fluent</a>, and I think both changes greatly improved readability of my tests.</p>
<p>Full diffs are here for comparison:</p>
<ul>
<li><a href="https://github.com/GraemeF/Twiddler/commit/6527ef85f36bef51b3db96c94b648148b39fb697">Moq&nbsp;&rarr; NSubstitute</a></li>
<li><a href="https://github.com/GraemeF/Twiddler/commit/d34993a656c2655ff690eaacb57b81e490861b84">xUnit.net Assert &rarr; Should.Fluent</a></li>
</ul>
	
</p>

<p><a href="http://graemef.com/framework-switcheroo">Permalink</a> 

	| <a href="http://graemef.com/framework-switcheroo#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1008774/8ac0a869b67d202159411bef4f0a50c9.jpeg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/3sTvC3tNstyx</posterous:profileUrl>
        <posterous:firstName>Graeme</posterous:firstName>
        <posterous:lastName>Foster</posterous:lastName>
        <posterous:nickName>GraemeF</posterous:nickName>
        <posterous:displayName>Graeme Foster</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Thu, 10 Feb 2011 07:01:00 -0800</pubDate>
      <title>A quick comparison of some .NET mocking frameworks</title>
      <link>http://graemef.com/42600017</link>
      <guid>http://graemef.com/42600017</guid>
      <description>
        <![CDATA[<p>
	<p>What's the collective noun for mocking frameworks? If there is one, then .NET has it!</p>
<p>I've used Moq for years but I'm always keen to make my tests more readable, so I thought it was time to compare some of the modern alternatives and see how they perform in a test fixture plucked almost at random from a project I recently worked on. So, here are the same tests using fakes from <a href="http://moq.me">Moq</a>, <a href="http://nsubstitute.github.com/">NSubstitute</a> and <a href="http://code.google.com/p/fakeiteasy/">FakeItEasy</a>, all of which are available from the&nbsp;<a href="http://nuget.org/">NuGet</a>&nbsp;gallery. If there's another hot framework you think compares well then let me know and I'll try it out too.</p>
<p><strong>Disclaimer</strong>: I'm quite familar with Moq but this is my first time with NSubstitute and FakeItEasy, so I'm not necesarily using the best option for these frameworks. If you spot something that would be better done in another way, fork the Gist on GitHub and let me know!</p>
<p><span style="font-size: large;">Setup</span></p>
<p>I use <a href="http://xunit.codeplex.com/">xUnit.net</a> which works slightly differently to most of the other test frameworks: it creates a new instance of your test fixture class for each test, which allows you to use field initializers and a constructor to set up your fakes. I take advantage of this in the following snippets.</p>
<p><span style="font-size: medium;">Moq</span></p>
<p>Most of the time we can use a LINQ query to set up a fake with Moq. This leads to nice and clean test set up as it can be done from a field initializer if you have setup that applies to all the tests in the fixture:</p>
<p><div class="data type-c">
    
      <table class="lines" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <pre class="line_numbers"><span rel="#L1" id="L1">1</span>
<span rel="#L2" id="L2">2</span>
<span rel="#L3" id="L3">3</span>
<span rel="#L4" id="L4">4</span>
<span rel="#L5" id="L5">5</span>
<span rel="#L6" id="L6">6</span>
<span rel="#L7" id="L7">7</span>
<span rel="#L8" id="L8">8</span>
<span rel="#L9" id="L9">9</span>
<span rel="#L10" id="L10">10</span>
</pre>
          </td>
          <td width="100%">
            
              
                <div class="highlight"><pre /><div class="line" id="LC1"><span class="k">public</span> <span class="k">class</span> <span class="nc">MyFixture</span></div><div class="line" id="LC2"><span class="p">{</span></div><div class="line" id="LC3">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">private</span> <span class="k">readonly</span> <span class="n">ICloseLogFileCommand</span> <span class="n">_closeCommand</span> <span class="p">=</span> <span class="n">Mock</span><span class="p">.</span><span class="n">Of</span><span class="p">&lt;</span><span class="n">ICloseLogFileCommand</span><span class="p">&gt;();</span></div><div class="line" id="LC4"><br /></div><div class="line" id="LC5">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">private</span> <span class="k">readonly</span> <span class="n">ILog</span> <span class="n">_log</span> <span class="p">=</span> <span class="n">Mocks</span><span class="p">.</span><span class="n">Of</span><span class="p">&lt;</span><span class="n">ILog</span><span class="p">&gt;().</span></div><div class="line" id="LC6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">First</span><span class="p">(</span><span class="n">x</span> <span class="p">=&gt;</span> <span class="n">x</span><span class="p">.</span><span class="n">Name</span> <span class="p">==</span> <span class="s">@&quot;C:\Path\To\File.log&quot;</span> <span class="p">&amp;&amp;</span></div><div class="line" id="LC7">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">x</span><span class="p">.</span><span class="n">Count</span> <span class="p">==</span> <span class="m">42</span> <span class="p">&amp;&amp;</span></div><div class="line" id="LC8">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">x</span><span class="p">.</span><span class="n">Offset</span> <span class="p">==</span> <span class="n">TimeSpan</span><span class="p">.</span><span class="n">FromSeconds</span><span class="p">(</span><span class="m">69</span><span class="p">));</span></div><div class="line" id="LC9">&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">...</span></div><div class="line" id="LC10"><span class="p">}</span></div></pre></div>
              
            
          </td>
        </tr>
      </table>
    
  </div></p>
<p>Quite succinct, no constructor needed, but a little bit ugly.</p>
<p><span style="font-size: medium;">NSubstitute</span></p>
<p>The instantiation of the fakes is very similar to Moq, but there is no equivalent to the LINQ setup so we need a constructor:</p>
<p><div class="data type-c">
    
      <table class="lines" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <pre class="line_numbers"><span rel="#L1" id="L1">1</span>
<span rel="#L2" id="L2">2</span>
<span rel="#L3" id="L3">3</span>
<span rel="#L4" id="L4">4</span>
<span rel="#L5" id="L5">5</span>
<span rel="#L6" id="L6">6</span>
<span rel="#L7" id="L7">7</span>
<span rel="#L8" id="L8">8</span>
<span rel="#L9" id="L9">9</span>
<span rel="#L10" id="L10">10</span>
<span rel="#L11" id="L11">11</span>
<span rel="#L12" id="L12">12</span>
<span rel="#L13" id="L13">13</span>
<span rel="#L14" id="L14">14</span>
</pre>
          </td>
          <td width="100%">
            
              
                <div class="highlight"><pre /><div class="line" id="LC1"><span class="k">public</span> <span class="k">class</span> <span class="nc">MyFixture</span></div><div class="line" id="LC2"><span class="p">{</span></div><div class="line" id="LC3">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">private</span> <span class="k">readonly</span> <span class="n">ICloseLogFileCommand</span> <span class="n">_closeCommand</span> <span class="p">=</span> <span class="n">Substitute</span><span class="p">.</span><span class="n">For</span><span class="p">&lt;</span><span class="n">ICloseLogFileCommand</span><span class="p">&gt;();</span></div><div class="line" id="LC4"><br /></div><div class="line" id="LC5">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">private</span> <span class="k">readonly</span> <span class="n">ILog</span> <span class="n">_log</span> <span class="p">=</span> <span class="n">Substitute</span><span class="p">.</span><span class="n">For</span><span class="p">&lt;</span><span class="n">ILog</span><span class="p">&gt;();</span></div><div class="line" id="LC6"><br /></div><div class="line" id="LC7">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="nf">MyFixture</span><span class="p">()</span></div><div class="line" id="LC8">&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class="line" id="LC9">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">_log</span><span class="p">.</span><span class="n">Name</span><span class="p">.</span><span class="n">Returns</span><span class="p">(</span><span class="s">@&quot;C:\Path\To\File.log&quot;</span><span class="p">);</span></div><div class="line" id="LC10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">_log</span><span class="p">.</span><span class="n">Count</span><span class="p">.</span><span class="n">Returns</span><span class="p">(</span><span class="m">42</span><span class="p">);</span></div><div class="line" id="LC11">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">_log</span><span class="p">.</span><span class="n">Offset</span><span class="p">.</span><span class="n">Returns</span><span class="p">(</span><span class="n">TimeSpan</span><span class="p">.</span><span class="n">FromSeconds</span><span class="p">(</span><span class="m">69</span><span class="p">));</span></div><div class="line" id="LC12">&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class="line" id="LC13">&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">...</span></div><div class="line" id="LC14"><span class="p">}</span></div></pre></div>
              
            
          </td>
        </tr>
      </table>
    
  </div></p>
<p>I find this very readable, and it's probably easier to understand than the LINQ setup.</p>
<p><span style="font-size: medium;">FakeItEasy</span></p>
<p>Slightly different take on instantiation, and again the setup needs to be done in a constructor:</p>
<p><div class="data type-c">
    
      <table class="lines" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <pre class="line_numbers"><span rel="#L1" id="L1">1</span>
<span rel="#L2" id="L2">2</span>
<span rel="#L3" id="L3">3</span>
<span rel="#L4" id="L4">4</span>
<span rel="#L5" id="L5">5</span>
<span rel="#L6" id="L6">6</span>
<span rel="#L7" id="L7">7</span>
<span rel="#L8" id="L8">8</span>
<span rel="#L9" id="L9">9</span>
<span rel="#L10" id="L10">10</span>
<span rel="#L11" id="L11">11</span>
<span rel="#L12" id="L12">12</span>
<span rel="#L13" id="L13">13</span>
<span rel="#L14" id="L14">14</span>
</pre>
          </td>
          <td width="100%">
            
              
                <div class="highlight"><pre /><div class="line" id="LC1"><span class="k">public</span> <span class="k">class</span> <span class="nc">MyFixture</span></div><div class="line" id="LC2"><span class="p">{</span></div><div class="line" id="LC3">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">private</span> <span class="k">readonly</span> <span class="n">ICloseLogFileCommand</span> <span class="n">_closeCommand</span> <span class="p">=</span> <span class="n">A</span><span class="p">.</span><span class="n">Fake</span><span class="p">&lt;</span><span class="n">ICloseLogFileCommand</span><span class="p">&gt;();</span></div><div class="line" id="LC4"><br /></div><div class="line" id="LC5">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">private</span> <span class="k">readonly</span> <span class="n">ILog</span> <span class="n">_log</span> <span class="p">=</span> <span class="n">A</span><span class="p">.</span><span class="n">Fake</span><span class="p">&lt;</span><span class="n">ILog</span><span class="p">&gt;();</span></div><div class="line" id="LC6"><br /></div><div class="line" id="LC7">&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="nf">MyFixture</span><span class="p">()</span></div><div class="line" id="LC8">&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class="line" id="LC9">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">A</span><span class="p">.</span><span class="n">CallTo</span><span class="p">(()</span> <span class="p">=&gt;</span> <span class="n">_log</span><span class="p">.</span><span class="n">Name</span><span class="p">).</span><span class="n">Returns</span><span class="p">(</span><span class="s">@&quot;C:\Path\To\File.log&quot;</span><span class="p">);</span></div><div class="line" id="LC10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">A</span><span class="p">.</span><span class="n">CallTo</span><span class="p">(()</span> <span class="p">=&gt;</span> <span class="n">_log</span><span class="p">.</span><span class="n">Count</span><span class="p">).</span><span class="n">Returns</span><span class="p">(</span><span class="m">42</span><span class="p">);</span></div><div class="line" id="LC11">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">A</span><span class="p">.</span><span class="n">CallTo</span><span class="p">(()</span> <span class="p">=&gt;</span> <span class="n">_log</span><span class="p">.</span><span class="n">Offset</span><span class="p">).</span><span class="n">Returns</span><span class="p">(</span><span class="n">TimeSpan</span><span class="p">.</span><span class="n">FromSeconds</span><span class="p">(</span><span class="m">69</span><span class="p">));</span></div><div class="line" id="LC12">&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class="line" id="LC13">&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">...</span></div><div class="line" id="LC14"><span class="p">}</span></div></pre></div>
              
            
          </td>
        </tr>
      </table>
    
  </div></p>
<p>The setup reads well, but is verbose when compared to NSubstitute.</p>
<p><span style="font-size: large;">Verification</span></p>
<p>In the following snippets we have a field referencing the fake object, and we want to verify that a method was called on it.</p>
<p><span style="font-size: medium;">Moq</span></p>
<p>We get the <code>Mock</code> for the fake object and verify:</p>
<p><div class="data type-c">
    
      <table class="lines" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <pre class="line_numbers"><span rel="#L1" id="L1">1</span>
<span rel="#L2" id="L2">2</span>
<span rel="#L3" id="L3">3</span>
<span rel="#L4" id="L4">4</span>
<span rel="#L5" id="L5">5</span>
<span rel="#L6" id="L6">6</span>
<span rel="#L7" id="L7">7</span>
<span rel="#L8" id="L8">8</span>
</pre>
          </td>
          <td width="100%">
            
              
                <div class="highlight"><pre /><div class="line" id="LC1"><span class="na">[Fact]</span></div><div class="line" id="LC2"><span class="k">public</span> <span class="k">void</span> <span class="nf">Initialize_Always_InitializesParserPresenter</span><span class="p">()</span></div><div class="line" id="LC3"><span class="p">{</span></div><div class="line" id="LC4">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">LogPresenter</span> <span class="n">test</span> <span class="p">=</span> <span class="n">BuildTestSubject</span><span class="p">();</span></div><div class="line" id="LC5">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">test</span><span class="p">.</span><span class="n">Initialize</span><span class="p">();</span></div><div class="line" id="LC6"><br /></div><div class="line" id="LC7">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Mock</span><span class="p">.</span><span class="n">Get</span><span class="p">(</span><span class="n">_parserPresenter</span><span class="p">).</span><span class="n">Verify</span><span class="p">(</span><span class="n">x</span> <span class="p">=&gt;</span> <span class="n">x</span><span class="p">.</span><span class="n">Initialize</span><span class="p">());</span></div><div class="line" id="LC8"><span class="p">}</span></div></pre></div>
              
            
          </td>
        </tr>
      </table>
    
  </div></p>
<p>Getting the <code>Mock</code> degrades readability a bit, but not bad.</p>
<p><span style="font-size: medium;">NSubstitute</span></p>
<p><div class="data type-c">
    
      <table class="lines" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <pre class="line_numbers"><span rel="#L1" id="L1">1</span>
<span rel="#L2" id="L2">2</span>
<span rel="#L3" id="L3">3</span>
<span rel="#L4" id="L4">4</span>
<span rel="#L5" id="L5">5</span>
<span rel="#L6" id="L6">6</span>
<span rel="#L7" id="L7">7</span>
<span rel="#L8" id="L8">8</span>
</pre>
          </td>
          <td width="100%">
            
              
                <div class="highlight"><pre /><div class="line" id="LC1"><span class="na">[Fact]</span></div><div class="line" id="LC2"><span class="k">public</span> <span class="k">void</span> <span class="nf">Initialize_Always_InitializesParserPresenter</span><span class="p">()</span></div><div class="line" id="LC3"><span class="p">{</span></div><div class="line" id="LC4">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">LogPresenter</span> <span class="n">test</span> <span class="p">=</span> <span class="n">BuildTestSubject</span><span class="p">();</span></div><div class="line" id="LC5">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">test</span><span class="p">.</span><span class="n">Initialize</span><span class="p">();</span></div><div class="line" id="LC6"><br /></div><div class="line" id="LC7">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">_parserPresenter</span><span class="p">.</span><span class="n">Received</span><span class="p">().</span><span class="n">Initialize</span><span class="p">();</span></div><div class="line" id="LC8"><span class="p">}</span></div></pre></div>
              
            
          </td>
        </tr>
      </table>
    
  </div></p>
<p>Wow. Couldn't really be any shorter, could it? My only criticism is that it doesn't scream "ASSERTION!!!" to me.</p>
<p><span style="font-size: medium;">FakeItEasy</span></p>
<p><div class="data type-c">
    
      <table class="lines" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <pre class="line_numbers"><span rel="#L1" id="L1">1</span>
<span rel="#L2" id="L2">2</span>
<span rel="#L3" id="L3">3</span>
<span rel="#L4" id="L4">4</span>
<span rel="#L5" id="L5">5</span>
<span rel="#L6" id="L6">6</span>
<span rel="#L7" id="L7">7</span>
<span rel="#L8" id="L8">8</span>
</pre>
          </td>
          <td width="100%">
            
              
                <div class="highlight"><pre /><div class="line" id="LC1"><span class="na">[Fact]</span></div><div class="line" id="LC2"><span class="k">public</span> <span class="k">void</span> <span class="nf">Initialize_Always_InitializesParserPresenter</span><span class="p">()</span></div><div class="line" id="LC3"><span class="p">{</span></div><div class="line" id="LC4">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">LogPresenter</span> <span class="n">test</span> <span class="p">=</span> <span class="n">BuildTestSubject</span><span class="p">();</span></div><div class="line" id="LC5">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">test</span><span class="p">.</span><span class="n">Initialize</span><span class="p">();</span></div><div class="line" id="LC6"><br /></div><div class="line" id="LC7">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">A</span><span class="p">.</span><span class="n">CallTo</span><span class="p">(()</span> <span class="p">=&gt;</span> <span class="n">_parserPresenter</span><span class="p">.</span><span class="n">Initialize</span><span class="p">()).</span><span class="n">MustHaveHappened</span><span class="p">();</span></div><div class="line" id="LC8"><span class="p">}</span></div></pre></div>
              
            
          </td>
        </tr>
      </table>
    
  </div></p>
<p>I like the way the fake is incorporated into the the call, it's much less intrusive than Moq. Ending with <code>MustHaveHappened</code> makes a pretty clear statement that verification is happening here.</p>
<p><span style="font-size: large;">Raising an event</span></p>
<p>In this test I want to check that the presenter raises its <code>PropertyChanged</code> event when the model's <code>PropertyChanged</code> event is raised. I'm making use of a <a href="https://caliburn.svn.codeplex.com/svn/trunk/src/Caliburn.Testability/Extensions/PropertyAssertionExtensions.cs">handy extension method from Caliburn.Testability</a> that lets me write <code>AssertThatChangeNotificationIsRaisedBy(<em>[property]</em>).When(<em>[something happens]</em>)</code>. In this case <em><code>[something happens]</code></em> is going to be the <code>PropertyChanged</code> event being raised on the model, and we're going to see how that is done with the different mocking frameworks.</p>
<p>In the interests of staying DRY, I usually make an extension method of my own to raise <code>PropertyChanged</code>, but I won't here so we can see how the frameworks work!</p>
<p><span style="font-size: medium;">Moq</span></p>
<p>Again we have to get the <code>Mock</code>, then we call <code>Raise</code> on it:</p>
<p><div class="data type-c">
    
      <table class="lines" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <pre class="line_numbers"><span rel="#L1" id="L1">1</span>
<span rel="#L2" id="L2">2</span>
<span rel="#L3" id="L3">3</span>
<span rel="#L4" id="L4">4</span>
<span rel="#L5" id="L5">5</span>
<span rel="#L6" id="L6">6</span>
<span rel="#L7" id="L7">7</span>
<span rel="#L8" id="L8">8</span>
<span rel="#L9" id="L9">9</span>
<span rel="#L10" id="L10">10</span>
<span rel="#L11" id="L11">11</span>
</pre>
          </td>
          <td width="100%">
            
              
                <div class="highlight"><pre /><div class="line" id="LC1"><span class="na">[Fact]</span></div><div class="line" id="LC2"><span class="k">public</span> <span class="k">void</span> <span class="nf">Offset_WhenLogOffsetChanges_RaisesPropertyChanged</span><span class="p">()</span></div><div class="line" id="LC3"><span class="p">{</span></div><div class="line" id="LC4">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">LogPresenter</span> <span class="n">test</span> <span class="p">=</span> <span class="n">BuildTestSubject</span><span class="p">();</span></div><div class="line" id="LC5"><br /></div><div class="line" id="LC6">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">test</span><span class="p">.</span><span class="n">Initialize</span><span class="p">();</span></div><div class="line" id="LC7"><br /></div><div class="line" id="LC8">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">test</span><span class="p">.</span><span class="n">AssertThatChangeNotificationIsRaisedBy</span><span class="p">(</span><span class="n">x</span> <span class="p">=&gt;</span> <span class="n">x</span><span class="p">.</span><span class="n">Offset</span><span class="p">).</span></div><div class="line" id="LC9">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">When</span><span class="p">(()</span> <span class="p">=&gt;</span> <span class="n">Mock</span><span class="p">.</span><span class="n">Get</span><span class="p">(</span><span class="n">_log</span><span class="p">).</span><span class="n">Raise</span><span class="p">(</span><span class="n">x</span> <span class="p">=&gt;</span> <span class="n">x</span><span class="p">.</span><span class="n">PropertyChanged</span> <span class="p">+=</span> <span class="k">null</span><span class="p">,</span> </div><div class="line" id="LC10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">new</span> <span class="nf">PropertyChangedEventArgs</span><span class="p">(</span><span class="s">&quot;Offset&quot;</span><span class="p">)));</span></div><div class="line" id="LC11"><span class="p">}</span></div></pre></div>
              
            
          </td>
        </tr>
      </table>
    
  </div></p>
<p>Still not keen on getting the <code>Mock</code>, and it's a shame we have to write <code>+= null</code> just to make a valid expression. Bit long and nasty.</p>
<p><span style="font-size: medium;">NSubstitute</span></p>
<p><div class="data type-c">
    
      <table class="lines" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <pre class="line_numbers"><span rel="#L1" id="L1">1</span>
<span rel="#L2" id="L2">2</span>
<span rel="#L3" id="L3">3</span>
<span rel="#L4" id="L4">4</span>
<span rel="#L5" id="L5">5</span>
<span rel="#L6" id="L6">6</span>
<span rel="#L7" id="L7">7</span>
<span rel="#L8" id="L8">8</span>
<span rel="#L9" id="L9">9</span>
<span rel="#L10" id="L10">10</span>
<span rel="#L11" id="L11">11</span>
</pre>
          </td>
          <td width="100%">
            
              
                <div class="highlight"><pre /><div class="line" id="LC1"><span class="na">[Fact]</span></div><div class="line" id="LC2"><span class="k">public</span> <span class="k">void</span> <span class="nf">Offset_WhenLogOffsetChanges_RaisesPropertyChanged</span><span class="p">()</span></div><div class="line" id="LC3"><span class="p">{</span></div><div class="line" id="LC4">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">LogPresenter</span> <span class="n">test</span> <span class="p">=</span> <span class="n">BuildTestSubject</span><span class="p">();</span></div><div class="line" id="LC5"><br /></div><div class="line" id="LC6">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">test</span><span class="p">.</span><span class="n">Initialize</span><span class="p">();</span></div><div class="line" id="LC7"><br /></div><div class="line" id="LC8">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">test</span><span class="p">.</span><span class="n">AssertThatChangeNotificationIsRaisedBy</span><span class="p">(</span><span class="n">x</span> <span class="p">=&gt;</span> <span class="n">x</span><span class="p">.</span><span class="n">Offset</span><span class="p">).</span></div><div class="line" id="LC9">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">When</span><span class="p">(()</span> <span class="p">=&gt;</span> <span class="n">_log</span><span class="p">.</span><span class="n">PropertyChanged</span> <span class="p">+=</span> <span class="n">Raise</span><span class="p">.</span><span class="n">Event</span><span class="p">&lt;</span><span class="n">PropertyChangedEventHandler</span><span class="p">&gt;(</span><span class="k">this</span><span class="p">,</span> </div><div class="line" id="LC10">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">new</span> <span class="nf">PropertyChangedEventArgs</span><span class="p">(</span><span class="s">&quot;Offset&quot;</span><span class="p">)));</span></div><div class="line" id="LC11"><span class="p">}</span></div></pre></div>
              
            
          </td>
        </tr>
      </table>
    
  </div></p>
<p>So close to being very nice, but spoiled by having to supply the generic argument to <code>Raise</code>. This <a href="http://nsubstitute.github.com/help/raising-events/">isn't always the case</a>, but as the <code>PropertyChanged</code> event is declared with a delegate it's necessary here. Still, it reads fairly well, certainly better than having <code>+= null</code> in the middle.</p>
<p><span style="font-size: medium;">FakeItEasy</span></p>
<p><div class="data type-c">
    
      <table class="lines" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <pre class="line_numbers"><span rel="#L1" id="L1">1</span>
<span rel="#L2" id="L2">2</span>
<span rel="#L3" id="L3">3</span>
<span rel="#L4" id="L4">4</span>
<span rel="#L5" id="L5">5</span>
<span rel="#L6" id="L6">6</span>
<span rel="#L7" id="L7">7</span>
<span rel="#L8" id="L8">8</span>
<span rel="#L9" id="L9">9</span>
<span rel="#L10" id="L10">10</span>
</pre>
          </td>
          <td width="100%">
            
              
                <div class="highlight"><pre /><div class="line" id="LC1"><span class="na">[Fact]</span></div><div class="line" id="LC2"><span class="k">public</span> <span class="k">void</span> <span class="nf">Offset_WhenLogOffsetChanges_RaisesPropertyChanged</span><span class="p">()</span></div><div class="line" id="LC3"><span class="p">{</span></div><div class="line" id="LC4">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">LogPresenter</span> <span class="n">test</span> <span class="p">=</span> <span class="n">BuildTestSubject</span><span class="p">();</span></div><div class="line" id="LC5"><br /></div><div class="line" id="LC6">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">test</span><span class="p">.</span><span class="n">Initialize</span><span class="p">();</span></div><div class="line" id="LC7"><br /></div><div class="line" id="LC8">&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">test</span><span class="p">.</span><span class="n">AssertThatChangeNotificationIsRaisedBy</span><span class="p">(</span><span class="n">x</span> <span class="p">=&gt;</span> <span class="n">x</span><span class="p">.</span><span class="n">Offset</span><span class="p">).</span></div><div class="line" id="LC9">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">When</span><span class="p">(()</span> <span class="p">=&gt;</span> <span class="n">_log</span><span class="p">.</span><span class="n">PropertyChanged</span> <span class="p">+=</span> <span class="n">Raise</span><span class="p">.</span><span class="n">With</span><span class="p">(</span><span class="k">new</span> <span class="n">PropertyChangedEventArgs</span><span class="p">(</span><span class="s">&quot;Offset&quot;</span><span class="p">)).</span><span class="n">Now</span><span class="p">);</span></div><div class="line" id="LC10"><span class="p">}</span></div></pre></div>
              
            
          </td>
        </tr>
      </table>
    
  </div></p>
<p>A lot shorter than NSubstitute and more readable than Moq, I think that's quite good. Although at first glance the <code>Now</code> on the end seems a bit odd.</p>
<p><span style="font-size: large;">Conclusion</span></p>
<p>Each of these frameworks has a lot more to offer than I've touched on here, covering just about anything you could do to an object (and probably a few things you wouldn't want to!). I wanted to see what the basic, everyday scenarios look like as those are the ones that really matter to me, and after this I will definitely try NSubstitute out on a real project.</p>
<p>It's amazing how far mocking frameworks have come in the last couple of years!</p>
	
</p>

<p><a href="http://graemef.com/42600017">Permalink</a> 

	| <a href="http://graemef.com/42600017#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1008774/8ac0a869b67d202159411bef4f0a50c9.jpeg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/3sTvC3tNstyx</posterous:profileUrl>
        <posterous:firstName>Graeme</posterous:firstName>
        <posterous:lastName>Foster</posterous:lastName>
        <posterous:nickName>GraemeF</posterous:nickName>
        <posterous:displayName>Graeme Foster</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Mon, 15 Feb 2010 20:29:29 -0800</pubDate>
      <title>Don't jump the red light!</title>
      <link>http://graemef.com/2010/02/dont-jump-the-red-light</link>
      <guid>http://graemef.com/2010/02/dont-jump-the-red-light</guid>
      <description>
        <![CDATA[<p>
	There&rsquo;s a good reason why the <a href="http://en.wikipedia.org/wiki/Test-driven_development">test-driven development cycle</a> says you should always watch a test fail before you write the production code that makes it pass. I was taught a lesson in this today, &ldquo;school of hard knocks&rdquo; style&hellip;
<h3>How did it happen?</h3>
I have a simple class which implements <code>INotifyPropertyChanged</code> and has property:
<div class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div class="CodeRay">
  <div class="code"><pre>public class MyClass : INotifyPropertyChanged
{
    private string _name;

    public string Name
    {
        get { return _name; }
        set
        {
            _name = value;
            PropertyChanged(this, new PropertyChangedEventArgs(&quot;Name&quot;));
        }
    }

    public event PropertyChangedEventHandler PropertyChanged = delegate { };
}</pre></div>
</div>

</div>
To test that the PropertyChanged event is raised at the appropriate time I use <a href="http://www.codeplex.com/caliburn">Caliburn</a>&rsquo;s handy (and very readable) <code>PropertyHasChangedAssertion</code>:
<div class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div class="CodeRay">
  <div class="code"><pre>[TestFixture]
public class MyClassTestFixture
{
    [Test]
    public void Name_WhenSet_RaisesPropertyChanged()
    {
        var test = new MyClass();

        test.AssertThatChangeNotificationIsRaisedBy(x =&gt; x.Name);
    }
}</pre></div>
</div>

</div>
At the time I obviously thought this was too simple to worry about, saw the test passed as expected and moved on. All good&hellip; Or so it seemed!

Fast forward a week or two. I started to get some strange errors &ndash; not test failures - in my MSBuild output:
<blockquote class="posterous_short_quote">
<code>error : Internal error: An unhandled exception occurred.</code>

<code> </code><code>error : System.Exception: No context was provided to test the notification, use When(Action affectProperty) to provide a context. </code>

<code> </code><code>error :&nbsp;&nbsp;&nbsp; at Caliburn.Testability.Assertions.PropertyHasChangedAssertion`2.Finalize()</code>
</blockquote>
Not only is the message a bit cryptic without any context (e.g. a test) but the error was intermittent. Oh joy! After a bit of detective work (more than you might think!) I realised that this is because the Caliburn&rsquo;s <code>PropertyHasChangedAssertion</code> checks that you called its <code>When(Action affectProperty)</code> method in its finalizer:
<div class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div class="CodeRay">
  <div class="code"><pre>~PropertyHasChangedAssertion()
{
    if(!_isValidAssertion)
        throw new Exception(
            &quot;No context was provided to test the notification, use When(Action affectProperty) to provide a context.&quot;);
}</pre></div>
</div>

</div>
While this makes the test extremely readable (which is, of course, extremely important), if you forget to call <code>When()</code>, if and when you get an error is up to the non-deterministic finalization gods. An easy one to fix:
<div class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<div class="CodeRay">
  <div class="code"><pre>[Test]
public void Name_WhenSet_RaisesPropertyChanged()
{
    var test = new MyClass();

    test.AssertThatChangeNotificationIsRaisedBy(x =&gt; x.Name)
        .When(() =&gt; test.Name = &quot;New name&quot;);
}</pre></div>
</div>

</div>
But I didn&rsquo;t get the feedback that I should have done from doing TDD properly, and wasted time as a result.
<h3>What went wrong?</h3>
Here is how TDD is <em>supposed</em> to be performed:

<div class='p_embed p_image_embed'>
<img alt="Media_httpfarm3static_fpbxl" height="359" src="http://getfile1.posterous.com/getfile/files.posterous.com/import-fjmy/dBEkdhFlFwluaFjBHeqsnodlkzuFlntnHEtmjdzCjGuJBtCwDzpEqugAxEar/media_httpfarm3static_FpBxl.jpg.scaled500.jpg" width="500" />
</div>


Because the code was trivial, I skipped the second step and didn&rsquo;t check that the test failed before I carried on and implemented the property. If I hadn&rsquo;t skipped this step, there&rsquo;s a good chance that the following sequence of events would have occurred:
<ol>
	<li><span style="background-color: #ffffff;">I write the test, and add an empty property definition to make it compile</span></li>
	<li><span style="background-color: #ffffff;">I run the test and <em>see that it unexpectedly passes</em></span></li>
	<li><span style="background-color: #ffffff;">I scratch my head for a bit, but I&rsquo;m already looking at the offending line of code so it&rsquo;s much easier to spot the problem</span></li>
	<li><span style="background-color: #ffffff;">The penny drops, I spot the mistake and fix it</span></li>
	<li><span style="background-color: #ffffff;">I run the test again, and this time it fails. Happy days.</span></li>
	<li><span style="background-color: #ffffff;">I implement the property changed notification and carry on</span></li>
</ol>
Maybe I would have got the error when I ran the test, and that would have given me another clue about the cause of the problem.
<h3>It could have been worse!</h3>
In the week or two since I made the mistake I could have carried on to use <code>AssertThatChangeNotificationIsRaisedBy</code> in tens or hundreds of other tests, which would have made it much harder to find the one with the missing <code>When()</code> call. I was lucky that there were only a few uses in my tests.
<h3>A lesson learned?</h3>
I hope so! When time is short it can be hard to make yourself go through these steps over and over again, but they are all there for a reason &ndash; <em>to stop us writing code that doesn&rsquo;t do what we think it does</em>. I will be trying especially hard to stick to the steps, but we&rsquo;ll have to wait and see how it goes.
	
</p>

<p><a href="http://graemef.com/2010/02/dont-jump-the-red-light">Permalink</a> 

	| <a href="http://graemef.com/2010/02/dont-jump-the-red-light#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1008774/8ac0a869b67d202159411bef4f0a50c9.jpeg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/3sTvC3tNstyx</posterous:profileUrl>
        <posterous:firstName>Graeme</posterous:firstName>
        <posterous:lastName>Foster</posterous:lastName>
        <posterous:nickName>GraemeF</posterous:nickName>
        <posterous:displayName>Graeme Foster</posterous:displayName>
      </posterous:author>
      <media:content type="image/jpeg" height="359" width="500" url="http://getfile9.posterous.com/getfile/files.posterous.com/import-fjmy/dBEkdhFlFwluaFjBHeqsnodlkzuFlntnHEtmjdzCjGuJBtCwDzpEqugAxEar/media_httpfarm3static_FpBxl.jpg">
        <media:thumbnail height="359" width="500" url="http://getfile1.posterous.com/getfile/files.posterous.com/import-fjmy/dBEkdhFlFwluaFjBHeqsnodlkzuFlntnHEtmjdzCjGuJBtCwDzpEqugAxEar/media_httpfarm3static_FpBxl.jpg.scaled500.jpg" />
      </media:content>
    </item>
    <item>
      <pubDate>Mon, 08 Feb 2010 20:22:53 -0800</pubDate>
      <title>How I'm Growing Object-Oriented Software, Guided by Tests</title>
      <link>http://graemef.com/2010/02/how-im-growing-object-oriented-software-guided-by-tests</link>
      <guid>http://graemef.com/2010/02/how-im-growing-object-oriented-software-guided-by-tests</guid>
      <description>
        <![CDATA[<p>
	<iframe scrolling="no" marginheight="0" src="http://rcm-uk.amazon.co.uk/e/cm?t=graemefcom-21&amp;o=2&amp;p=8&amp;l=as1&amp;asins=0321503627&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=000000&amp;bg1=FFFFFF&amp;f=ifr" marginwidth="0" frameborder="0" align="right" style="height: 240px;"></iframe>
<a href="http://www.growing-object-oriented-software.com/">Growing Object-Oriented Software, Guided by Tests</a> (that's <a href="http://twitter.com/#search?q=%23goos">#goos</a> on Twitter) by <a href="http://www.m3p.co.uk/">Steve Freeman</a> and <a href="http://www.natpryce.com/">Nat Pryce</a> is a book about test-driven development. Here are a few notes on my experiences of following its methods.

<h3>The Story So Far</h3>
I was fortunate enough to start work on a new desktop application in the middle of last year, around the time I read through the freely-available online version of the book before it was finally published in November. This was an ideal opportunity to put TDD into practice so I started by building a &ldquo;walking skeleton&rdquo; using <a href="http://www.codeplex.com/CompositeWPF">Prism</a>, <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">CruiseControl.NET</a>, <a href="http://wix.sourceforge.net/">WiX</a>, <a href="http://www.gallio.org/">Gallio</a>, <a href="http://www.mbunit.com/">MbUnit</a>, <a href="http://www.ncover.com/">NCover</a> and <a href="http://white.codeplex.com/">White</a> as a wrapper around <a href="http://msdn.microsoft.com/en-us/library/ms747327.aspx">UI Automation</a> for the acceptance tests, and took it from there.

I&rsquo;ll admit that there was a slow start (WPF/Prism and White/UI Automation were new to me too) but development speed has been steadily increasing ever since, and now I&rsquo;m able to get what feels like a lot done each day. And that&rsquo;s pretty much <em>every</em> day; it&rsquo;s been a long time since I&rsquo;ve had to halt progress for a significant amount of time in order to squash a bug or redo a chunk of work.
<h3>Where am I now?</h3>
I&rsquo;m still learning. It&rsquo;s easy to slip back into changing code then updating the tests to match, and I do find myself doing that sometimes. I&rsquo;m also finding it hard to perform only one refactoring step at a time (oh, let me just rename that class while I&rsquo;m here&hellip;), and the acceptance tests can be brittle and sometimes feel like a burden to write. But what doesn&rsquo;t kill you makes you stronger, right? It&rsquo;s getting noticeably easier as I learn and improve, and every bit of pain along the way has been worth it.
<h3>Does it work?</h3>
For me, <strong>yes</strong>. Test-driven development feels <em>so right </em>that I don&rsquo;t think I could ever go back to hacking stuff together without building the safety net of tests to fall back on as I go. I am sure that my design is much better than anything I have produced before, and that I have far fewer bugs than usual, too :)

So this experience has been nothing short of (professional) life-changing. I have read similar stuff before, but <em>GOOS</em> was the one that finally made me &ldquo;get it.&rdquo;
	
</p>

<p><a href="http://graemef.com/2010/02/how-im-growing-object-oriented-software-guided-by-tests">Permalink</a> 

	| <a href="http://graemef.com/2010/02/how-im-growing-object-oriented-software-guided-by-tests#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1008774/8ac0a869b67d202159411bef4f0a50c9.jpeg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/3sTvC3tNstyx</posterous:profileUrl>
        <posterous:firstName>Graeme</posterous:firstName>
        <posterous:lastName>Foster</posterous:lastName>
        <posterous:nickName>GraemeF</posterous:nickName>
        <posterous:displayName>Graeme Foster</posterous:displayName>
      </posterous:author>
    </item>
    <item>
      <pubDate>Sat, 06 Feb 2010 16:39:29 -0800</pubDate>
      <title>Hello again, World!</title>
      <link>http://graemef.com/2010/02/hello-again-world</link>
      <guid>http://graemef.com/2010/02/hello-again-world</guid>
      <description>
        <![CDATA[<p>
	<div class="crestock-img" style="margin: 1em; display: block;">
<div><dl class="wp-caption alignright" style=""> <dt class="wp-caption-dt"><div class='p_embed p_image_embed'>
<img alt="" src="http://posterous.com/wp-content/uploads/crestockimages/1262735-ms.jpg" />
</div>
</dt> <dd class="wp-caption-dd crestock-img-attribution" style="font-size: 0.8em;">
<a href="http://www.crestock.com/image/1262735-Hello-Sand-message.aspx">Hello Sand message</a> from <a href="http://www.crestock.com/free-image.aspx">Crestock Creative Photos</a>
</dd> </dl></div>
</div>
<em>GraemeF.com</em> has been around in one form or another since 2001, but I had a poke around the blog content and decided that each bit fell into one or more of the following categories:
<ol>
	<li>Outdated technical posts that would be downright misleading now;</li>
	<li>Personal stuff that the Interwebs should not be interested in;</li>
	<li>Links auto-posted from <a href="http://delicious.com/GraemeF">my Del.icio.us account</a>;</li>
	<li>Factually inaccurate bullshit.</li>
</ol>
So, rather than actually create categories for the above, I decided to reboot my blog, and now all of the old content is gone.
<h3>So what now?</h3>
It&rsquo;s time for a fresh start. Having dabbled with product management for a while and ultimately decided that it&rsquo;s not for me, I&rsquo;m back to being a full-time software developer, and that&rsquo;s what I intend to write about.

However, what&rsquo;s more likely to happen is:
<ol>
	<li>I start off well, with a couple of posts about test driven development and the like;</li>
	<li>The posts get shorter and shorter and are spaced farther and farther apart;</li>
	<li>In a year&rsquo;s time I&rsquo;ve all but forgotten about it when the hosting charge is applied to my debit card, for which my wife never forgives me.</li>
</ol>
Sounds like a plan! :)
	
</p>

<p><a href="http://graemef.com/2010/02/hello-again-world">Permalink</a> 

	| <a href="http://graemef.com/2010/02/hello-again-world#comment">Leave a comment&nbsp;&nbsp;&raquo;</a>

</p>]]>
      </description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/1008774/8ac0a869b67d202159411bef4f0a50c9.jpeg</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/3sTvC3tNstyx</posterous:profileUrl>
        <posterous:firstName>Graeme</posterous:firstName>
        <posterous:lastName>Foster</posterous:lastName>
        <posterous:nickName>GraemeF</posterous:nickName>
        <posterous:displayName>Graeme Foster</posterous:displayName>
      </posterous:author>
    </item>
  </channel>
</rss>

