<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>.net and other musings &#187; TestDrivenDevelopment</title>
	<atom:link href="http://benl.wordpress.com/category/testdrivendevelopment/feed/" rel="self" type="application/rss+xml" />
	<link>http://benl.wordpress.com</link>
	<description>Ben Lovell, an agile developer living in the UK.</description>
	<lastBuildDate>Thu, 16 Jul 2009 09:43:48 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='benl.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/43c6fe283d98c1764e951cd6dfface61?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>.net and other musings &#187; TestDrivenDevelopment</title>
		<link>http://benl.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://benl.wordpress.com/osd.xml" title=".net and other musings" />
		<item>
		<title>Incremental development with Monorail: Part Seven</title>
		<link>http://benl.wordpress.com/2008/05/15/incremental-development-with-monorail-part-seven/</link>
		<comments>http://benl.wordpress.com/2008/05/15/incremental-development-with-monorail-part-seven/#comments</comments>
		<pubDate>Thu, 15 May 2008 17:11:54 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Monorail]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[TestDrivenDevelopment]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Windsor]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/05/15/incremental-development-with-monorail-part-seven/</guid>
		<description><![CDATA[Since our last installment I slipped in a ninja-edit to one of the configuration files. This was to ensure that our sole service was marked as transient rather than the default Windsor lifestyle of singleton. This was pointed out to me by an eagle-eyed commenter and was an oversight on my part. So we&#8217;re now [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=385&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Since our last installment I slipped in a ninja-edit to one of the configuration files. This was to ensure that our sole service was marked as transient rather than the default Windsor lifestyle of singleton. This was pointed out to me by an <a href="http://justinram.wordpress.com/">eagle-eyed commenter</a> and was an oversight on my part. So we&#8217;re now at rev10 and ready to roll once again!</p>
<p>In our last post we tidied up a few bits and improved our code-base rather than actually adding features as such. This time we&#8217;re going to move down into the persistence and start to drive out this notional layer.</p>
<p>We&#8217;re going to handle data access using the repository pattern. The repositories will work on our ActiveRecord entities ensuring they&#8217;re persisted to our database. We will introduce a new interaction between our service <strong>BlogPostService </strong>and the newly introduced repository interface <strong>IBlogPostRepository</strong>. Let&#8217;s get on and write a test:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/71.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="407" alt="71" src="http://benl.files.wordpress.com/2008/05/71-thumb.png?w=508&#038;h=407" width="508" border="0"></a> </p>
<p>The test above is fairly self-explanatory. We&#8217;ve introduced the <strong>IBlogPostRepository </strong>and we&#8217;re passing it into our <strong>BlogPostService </strong>which should then call the <strong>Save </strong>method passing our mapped <strong>post</strong>. We need to get rid of the red code and get the test passing, so first we must create our new interface, and then modify the service constructor:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/72.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="77" alt="72" src="http://benl.files.wordpress.com/2008/05/72-thumb.png?w=508&#038;h=77" width="508" border="0"></a> </p>
<p><a href="http://benl.files.wordpress.com/2008/05/73.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="118" alt="73" src="http://benl.files.wordpress.com/2008/05/73-thumb.png?w=508&#038;h=118" width="508" border="0"></a> </p>
<p>We need to modify our other tests that construct the <strong>BlogPostService </strong>as they&#8217;re still assuming only a single argument constructor exists. As we have some duplication going on we&#8217;ll push this construction up into our setup code:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/74.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="282" alt="74" src="http://benl.files.wordpress.com/2008/05/74-thumb.png?w=508&#038;h=282" width="508" border="0"></a> </p>
<p>We should be able to run our tests in this fixture now:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/75.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="143" alt="75" src="http://benl.files.wordpress.com/2008/05/75-thumb.png?w=508&#038;h=143" width="508" border="0"></a> </p>
<p>As expected, since our <strong>BlogPostService </strong>doesn&#8217;t actually do much with our repository yet, we need to do some pretty minor tweaking to pass this test:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/76.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="113" alt="76" src="http://benl.files.wordpress.com/2008/05/76-thumb.png?w=508&#038;h=113" width="508" border="0"></a></p>
<p>Let&#8217;s try again now:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/77.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="56" alt="77" src="http://benl.files.wordpress.com/2008/05/77-thumb.png?w=508&#038;h=56" width="508" border="0"></a>&nbsp; Cool, let us try and run the whole suite including our integration type tests:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/78.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="138" alt="78" src="http://benl.files.wordpress.com/2008/05/78-thumb.png?w=508&#038;h=138" width="508" border="0"></a> </p>
<p>The integration tests are failing as we&#8217;ve yet to map the new dependency in our Windsor configuration. We can specify this now:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/79.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="54" alt="79" src="http://benl.files.wordpress.com/2008/05/79-thumb.png?w=508&#038;h=54" width="508" border="0"></a> </p>
<p>We still have failing integration tests though, so we need to add the <strong>BlogPostRepository</strong> specified in our configuration:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/80.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="142" alt="80" src="http://benl.files.wordpress.com/2008/05/80-thumb.png?w=508&#038;h=142" width="508" border="0"></a> </p>
<p>As you can see it doesn&#8217;t do much, but we just want our tests passing at this stage. Let&#8217;s run the whole suite of tests now:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/81.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="30" alt="81" src="http://benl.files.wordpress.com/2008/05/81-thumb.png?w=476&#038;h=30" width="476" border="0"></a> </p>
<p>Great, we have a working product once more. I&#8217;m going to finish here, as ever, the latest changes have been committed:</p>
<p><a title="http://code.google.com/p/mr-blogengine/" href="http://code.google.com/p/mr-blogengine/">http://code.google.com/p/mr-blogengine/</a></p>
<p>Next time we&#8217;ll make our new repository more useful and <em>finally </em>hit the database!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/385/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/385/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/385/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=385&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/05/15/incremental-development-with-monorail-part-seven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/71-thumb.png" medium="image">
			<media:title type="html">71</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/72-thumb.png" medium="image">
			<media:title type="html">72</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/73-thumb.png" medium="image">
			<media:title type="html">73</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/74-thumb.png" medium="image">
			<media:title type="html">74</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/75-thumb.png" medium="image">
			<media:title type="html">75</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/76-thumb.png" medium="image">
			<media:title type="html">76</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/77-thumb.png" medium="image">
			<media:title type="html">77</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/78-thumb.png" medium="image">
			<media:title type="html">78</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/79-thumb.png" medium="image">
			<media:title type="html">79</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/80-thumb.png" medium="image">
			<media:title type="html">80</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/81-thumb.png" medium="image">
			<media:title type="html">81</media:title>
		</media:content>
	</item>
		<item>
		<title>Incremental development with Monorail: Part Six</title>
		<link>http://benl.wordpress.com/2008/05/05/incremental-development-with-monorail-part-six/</link>
		<comments>http://benl.wordpress.com/2008/05/05/incremental-development-with-monorail-part-six/#comments</comments>
		<pubDate>Mon, 05 May 2008 09:50:14 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[Castle]]></category>
		<category><![CDATA[Monorail]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[TestDrivenDevelopment]]></category>
		<category><![CDATA[Windsor]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/05/05/incremental-development-with-monorail-part-six/</guid>
		<description><![CDATA[We finished up in part five with a full suite of passing tests and our BlogPostService is slowly taking shape now. The next few posts will introduce persistence and validation but before we get started on these features, we have a little housekeeping to perform on our existing code. 
First step is to build the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=362&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We finished up in part five with a full suite of passing tests and our <strong>BlogPostService </strong>is slowly taking shape now. The next few posts will introduce persistence and validation but before we get started on these features, we have a little housekeeping to perform on our existing code. </p>
<p>First step is to build the Castle trunk and update our references to the latest versions. Secondly, we&#8217;ll incorporate a few changes suggested by <a href="http://hammett.castleproject.org/?p=280">Hammett</a>.</p>
<p>After building and replacing our references with the latest Castle build I&#8217;ll run the tests as a sanity check before we proceed:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/62.png"><img style="border-width:0;" height="28" alt="62" src="http://benl.files.wordpress.com/2008/05/62-thumb.png?w=508&#038;h=28" width="508" border="0"></a> </p>
<p>With that out of the way our first code change will ensure we play nicely with HTTP. It is considered good practice to ensure requests which update or create resources is carried out via POST &#8211; so we can modify our only <strong>PostController.Save</strong> action to ensure this is so but before we do this we&#8217;ll write a test:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/60.png"><img style="border-width:0;" height="105" alt="60" src="http://benl.files.wordpress.com/2008/05/60-thumb.png?w=508&#038;h=105" width="508" border="0"></a> </p>
<p>Running our test produces the following:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/61.png"><img style="border-width:0;" height="36" alt="61" src="http://benl.files.wordpress.com/2008/05/61-thumb.png?w=508&#038;h=36" width="508" border="0"></a> </p>
<p>We&#8217;ll modify our <strong>Save </strong>action now to ensure we only accept the <strong>POST</strong> verb:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/63.png"><img style="border-width:0;" height="130" alt="63" src="http://benl.files.wordpress.com/2008/05/63-thumb.png?w=508&#038;h=130" width="508" border="0"></a></p>
<p>We have added the <strong>AccessibleThrough </strong>attribute and explicitly specified that our action must only allow the <strong>POST</strong> verb. We&#8217;ll run our test again and make sure everything is working as expected:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/64.png"><img style="border-width:0;" height="26" alt="64" src="http://benl.files.wordpress.com/2008/05/64-thumb.png?w=508&#038;h=26" width="508" border="0"></a> </p>
<p>The next step is to modify our <strong>add.vm </strong>view to use the helper methods to generate our form tags. We&#8217;ve done that and once again we&#8217;ll run our tests:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/65.png"><img style="border-width:0;" height="25" alt="65" src="http://benl.files.wordpress.com/2008/05/65-thumb.png?w=508&#038;h=25" width="508" border="0"></a> </p>
<p>I&#8217;m noticing a little duplication creeping in to our integration tests that should be removed. Also, until now we&#8217;ve had to assume that a web server is running on a specific port on our development machine in order to run the integration tests. Through a little tweaking we can spin-up a temporary server in our test fixture setup code and host our test code there instead.</p>
<p>First we add the <strong>WebDev.WebHost.dll </strong>to our <strong>lib </strong>project directory and ensure we&#8217;re referencing this from the testing project. The next step is to create an <strong>app.config</strong> file in the testing project so we can configure where and from which port our testing server should be hosting from:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/66.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="114" alt="66" src="http://benl.files.wordpress.com/2008/05/66-thumb.png?w=508&#038;h=114" width="508" border="0"></a>&nbsp; Now we add some setup code for the fixture:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/67.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="241" alt="67" src="http://benl.files.wordpress.com/2008/05/67-thumb.png?w=508&#038;h=241" width="508" border="0"></a> </p>
<p>We&#8217;ll also make sure we bring the server down when we&#8217;re finished:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/68.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="98" alt="68" src="http://benl.files.wordpress.com/2008/05/68-thumb.png?w=508&#038;h=98" width="508" border="0"></a> </p>
<p>Now ensure the VS web server is not running on the same port, then we can run our tests and make sure our latest changes work out:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/69.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="81" alt="69" src="http://benl.files.wordpress.com/2008/05/69-thumb.png?w=508&#038;h=81" width="508" border="0"></a> </p>
<p>Now, since we specify the web root and port through configuration, we should also use these configurable values to determine the URLs in our tests:</p>
<p><a href="http://benl.files.wordpress.com/2008/05/70.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="169" alt="70" src="http://benl.files.wordpress.com/2008/05/70-thumb.png?w=508&#038;h=169" width="508" border="0"></a> </p>
<p>You can see our tests now call <strong>BuildTestUrl </strong>to determine the full URL where we&#8217;re hosting the development server. Neat. I&#8217;m sure when we add further integration fixtures we&#8217;ll extract class this, but for now we have a nice working set of tests and should remember the principle of YAGNI!</p>
<p>I&#8217;m going to cut this installment short here. In the next post we&#8217;ll get back into the swing of it and continue implementing features.</p>
<p>As ever, the latest code has been checked in and is available here:</p>
<p><a href="http://code.google.com/p/mr-blogengine/">http://code.google.com/p/mr-blogengine/</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/362/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/362/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/362/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=362&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/05/05/incremental-development-with-monorail-part-six/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/62-thumb.png" medium="image">
			<media:title type="html">62</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/60-thumb.png" medium="image">
			<media:title type="html">60</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/61-thumb.png" medium="image">
			<media:title type="html">61</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/63-thumb.png" medium="image">
			<media:title type="html">63</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/64-thumb.png" medium="image">
			<media:title type="html">64</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/65-thumb.png" medium="image">
			<media:title type="html">65</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/66-thumb.png" medium="image">
			<media:title type="html">66</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/67-thumb.png" medium="image">
			<media:title type="html">67</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/68-thumb.png" medium="image">
			<media:title type="html">68</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/69-thumb.png" medium="image">
			<media:title type="html">69</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/05/70-thumb.png" medium="image">
			<media:title type="html">70</media:title>
		</media:content>
	</item>
		<item>
		<title>MVC Storefront</title>
		<link>http://benl.wordpress.com/2008/04/29/mvc-storefront/</link>
		<comments>http://benl.wordpress.com/2008/04/29/mvc-storefront/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 07:20:57 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Castle]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Monorail]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[TestDrivenDevelopment]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/04/29/mvc-storefront/</guid>
		<description><![CDATA[Rob Conery has been posting a series of screencasts featuring the development of an ASP.NET MVC based product catalogue. This is being carried out in a &#8220;TDD&#8221; like fashion. The interesting difference between his posts and mine (apart from the obvious fact that I&#8217;m lazy and haven&#8217;t screencasted&#8230; yet) is that he starts from the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=339&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://blog.wekeroad.com/" target="_blank">Rob Conery</a> has been posting a <a href="http://blog.wekeroad.com/mvc-storefront/mvcstore-part-6/" target="_blank">series of screencasts</a> featuring the development of an ASP.NET MVC based product catalogue. This is being carried out in a &#8220;TDD&#8221; like fashion. The interesting difference between his posts and mine (apart from the obvious fact that I&#8217;m lazy and haven&#8217;t screencasted&#8230; yet) is that he starts from the bottom of the stack and works upwards towards the UI where as I do the opposite.</p>
<p>Its interesting contrasting the two approaches not to mention the differences between the ASP.NET MVC framework and Castle Monorail way of getting things done.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/339/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/339/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/339/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=339&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/04/29/mvc-storefront/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>
	</item>
		<item>
		<title>Incremental development with Monorail: Part Five</title>
		<link>http://benl.wordpress.com/2008/04/24/incremental-development-with-monorail-part-five/</link>
		<comments>http://benl.wordpress.com/2008/04/24/incremental-development-with-monorail-part-five/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 20:20:29 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[Monorail]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[TestDrivenDevelopment]]></category>
		<category><![CDATA[Windsor]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/04/24/incremental-development-with-monorail-part-five/</guid>
		<description><![CDATA[Welcome back. In this post I&#8217;ll be getting our tests passing again and cleaning things up a little. We left off with a failing integration test:
 
I suspect this is due to the IBlogPostMapper dependency we introduced to our BlogPostService not being handled by the container. If we run in the browser we can confirm [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=338&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Welcome back. In this post I&#8217;ll be getting our tests passing again and cleaning things up a little. We left off with a failing integration test:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/421.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="125" alt="42" src="http://benl.files.wordpress.com/2008/04/42-thumb1.png?w=508&#038;h=125" width="508" border="0"></a> </p>
<p>I suspect this is due to the <strong>IBlogPostMapper </strong>dependency we introduced to our <strong>BlogPostService </strong>not being handled by the container. If we run in the browser we can confirm this is in fact true:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="315" alt="" src="http://benl.files.wordpress.com/2008/04/thumb.png?w=504&#038;h=315" width="504" border="0"></a> </p>
<p>As we&#8217;ve yet to implement our <strong>IBlogPostMapper </strong>we must go ahead and do this before we can add the container configuration to pass our integration test. Lets bust out a test and get things rolling:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/43.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="462" alt="43" src="http://benl.files.wordpress.com/2008/04/43-thumb.png?w=508&#038;h=462" width="508" border="0"></a> </p>
<p>We have a few blanks to fill in in order to get this to compile and run:</p>
<ol>
<li>Make the DTO&#8217;s properties virtual so we can mock them. This is in preference to extracting an interface<strong>. </strong></li>
<li>Implement <strong>IBlogPostMapper</strong>.</li>
<li>Add the necessary properties to the <strong>IBlogPost </strong>interface.</li>
</ol>
<p>Lets go ahead and do this now:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/44.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="438" alt="44" src="http://benl.files.wordpress.com/2008/04/44-thumb.png?w=508&#038;h=438" width="508" border="0"></a></p>
<p><strong>IBlogPostMapper </strong>minimal implementation:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/45.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="162" alt="45" src="http://benl.files.wordpress.com/2008/04/45-thumb.png?w=508&#038;h=162" width="508" border="0"></a>&nbsp; </p>
<p>The necessary modifications to <strong>IBlogPost</strong>:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/46.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="167" alt="46" src="http://benl.files.wordpress.com/2008/04/46-thumb.png?w=508&#038;h=167" width="508" border="0"></a> </p>
<p>Now we can compile and run our test:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/47.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="95" alt="47" src="http://benl.files.wordpress.com/2008/04/47-thumb.png?w=508&#038;h=95" width="508" border="0"></a> </p>
<p>Our <strong>BlogPostMapper </strong>implementation is throwing an exception so lets go back and take another step to try and pass our test:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/48.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="133" alt="48" src="http://benl.files.wordpress.com/2008/04/48-thumb.png?w=508&#038;h=133" width="508" border="0"></a> </p>
<p><strong>BlogPost</strong>:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/49.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="418" alt="49" src="http://benl.files.wordpress.com/2008/04/49-thumb.png?w=508&#038;h=418" width="508" border="0"></a> </p>
<p>I&#8217;m pretty certain we&#8217;ve done enough to pass our test now. Lets have a go:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/50.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="38" alt="50" src="http://benl.files.wordpress.com/2008/04/50-thumb.png?w=508&#038;h=38" width="508" border="0"></a> </p>
<p>OK now lets focus on the full suite:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/51.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="129" alt="51" src="http://benl.files.wordpress.com/2008/04/51-thumb.png?w=508&#038;h=129" width="508" border="0"></a> </p>
<p>Our integration test is still bombing but as we&#8217;ve got a mapper now, we can go ahead and wire up our Windsor configuration and get things moving again:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/52.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="84" alt="52" src="http://benl.files.wordpress.com/2008/04/52-thumb.png?w=508&#038;h=84" width="508" border="0"></a> </p>
<p>We&#8217;ve added another configuration file: <strong>mapper.config</strong> and referenced this from the <strong>web.config</strong>. We shouldn&#8217;t need to do any more than this so lets run our full test suite:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/53.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="28" alt="53" src="http://benl.files.wordpress.com/2008/04/53-thumb.png?w=508&#038;h=28" width="508" border="0"></a> </p>
<p>Our full suite is passing now. Not bad for 5 minutes work! As usual the latest changes are checked in to the <a href="http://code.google.com/p/mr-blogengine/" target="_blank">Google code project hosted here.</a></p>
<p>Now we have a full passing suite, in our next edition I&#8217;ll be moving down into the persistence and also incorporating a <a href="http://hammett.castleproject.org/?p=280" target="_blank">few modifications from Hammett</a>. Stay tuned!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/338/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/338/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/338/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=338&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/04/24/incremental-development-with-monorail-part-five/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/42-thumb1.png" medium="image">
			<media:title type="html">42</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/thumb.png" medium="image" />

		<media:content url="http://benl.files.wordpress.com/2008/04/43-thumb.png" medium="image">
			<media:title type="html">43</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/44-thumb.png" medium="image">
			<media:title type="html">44</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/45-thumb.png" medium="image">
			<media:title type="html">45</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/46-thumb.png" medium="image">
			<media:title type="html">46</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/47-thumb.png" medium="image">
			<media:title type="html">47</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/48-thumb.png" medium="image">
			<media:title type="html">48</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/49-thumb.png" medium="image">
			<media:title type="html">49</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/50-thumb.png" medium="image">
			<media:title type="html">50</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/51-thumb.png" medium="image">
			<media:title type="html">51</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/52-thumb.png" medium="image">
			<media:title type="html">52</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/53-thumb.png" medium="image">
			<media:title type="html">53</media:title>
		</media:content>
	</item>
		<item>
		<title>Incremental development with Monorail: Part Four</title>
		<link>http://benl.wordpress.com/2008/04/17/incremental-development-with-monorail-part-four/</link>
		<comments>http://benl.wordpress.com/2008/04/17/incremental-development-with-monorail-part-four/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 19:35:28 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[Monorail]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[TestDrivenDevelopment]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/04/17/incremental-development-with-monorail-part-four/</guid>
		<description><![CDATA[We finished up in the last instalment by moving down a layer into our newly introduced BlogPostService. Our tests are passing yet our application is still pretty lacking in the actual functionality department. To move things on a stage further we need to: 

Map from the AddPostRequestDto to our actual BlogPost aggregate root.
Validate the BlogPost.
Persist [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=311&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We finished up in the last instalment by moving down a layer into our newly introduced <strong>BlogPostService. </strong>Our tests are passing yet our application is still pretty lacking in the actual functionality department. To move things on a stage further we need to: </p>
<ol>
<li>Map from the <strong>AddPostRequestDto </strong>to our actual <strong>BlogPost </strong>aggregate root.
<li>Validate the <strong>BlogPost.</strong>
<li>Persist our new <strong>BlogPost</strong>.</li>
</ol>
<p>We need to write another test to flesh out the interaction between our service and something that can map from the DTO to our <strong>BlogPost:</strong></p>
<p><a href="http://benl.files.wordpress.com/2008/04/37.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="238" alt="37" src="http://benl.files.wordpress.com/2008/04/37-thumb.png?w=508&#038;h=238" width="508" border="0"></a> </p>
<p>We&#8217;re now expecting the <strong>BlogPostService</strong> to accept the mapper in its constructor, and defining an interaction between the service and the mapper. Before we can get this to compile we need to make a few more changes to our test fixture:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/371.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="508" alt="37" src="http://benl.files.wordpress.com/2008/04/37-thumb1.png?w=508&#038;h=508" width="508" border="0"></a> </p>
<p>We&#8217;ve modified an existing test to allow for our new dependency and performed some setup tasks. We&#8217;ve introduced the <strong>IBlogPostMapper </strong>and <strong>IBlogPost </strong>interfaces by way of our test. Running the test causes the compiler to choke so lets go ahead and implement what we need to pass the tests:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/38.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="133" alt="38" src="http://benl.files.wordpress.com/2008/04/38-thumb.png?w=508&#038;h=133" width="508" border="0"></a> </p>
<p><a href="http://benl.files.wordpress.com/2008/04/39.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="125" alt="39" src="http://benl.files.wordpress.com/2008/04/39-thumb.png?w=508&#038;h=125" width="508" border="0"></a> </p>
<p><a href="http://benl.files.wordpress.com/2008/04/40.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="250" alt="40" src="http://benl.files.wordpress.com/2008/04/40-thumb.png?w=508&#038;h=250" width="508" border="0"></a> </p>
<p>Lets go ahead and run our <strong>BlogPostServiceFixture </strong>tests:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/41.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="43" alt="41" src="http://benl.files.wordpress.com/2008/04/41-thumb.png?w=508&#038;h=43" width="508" border="0"></a> </p>
<p>Righteo, that went well. For the sake of completeness lets run our full test suite:</p>
<p><a href="http://benl.files.wordpress.com/2008/04/42.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="125" alt="42" src="http://benl.files.wordpress.com/2008/04/42-thumb.png?w=508&#038;h=125" width="508" border="0"></a> </p>
<p>The integration test is failing as we&#8217;ve yet to wire up the <strong>BlogPostService </strong>dependencies in the container. Before we can do this we need to drive out the interfaces we&#8217;ve introduced. We&#8217;ll do that in the next post.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/311/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/311/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/311/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=311&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/04/17/incremental-development-with-monorail-part-four/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/37-thumb.png" medium="image">
			<media:title type="html">37</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/37-thumb1.png" medium="image">
			<media:title type="html">37</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/38-thumb.png" medium="image">
			<media:title type="html">38</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/39-thumb.png" medium="image">
			<media:title type="html">39</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/40-thumb.png" medium="image">
			<media:title type="html">40</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/41-thumb.png" medium="image">
			<media:title type="html">41</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/04/42-thumb.png" medium="image">
			<media:title type="html">42</media:title>
		</media:content>
	</item>
		<item>
		<title>Incremental development with Monorail: Part Two</title>
		<link>http://benl.wordpress.com/2008/03/27/incremental-development-with-monorail-part-two/</link>
		<comments>http://benl.wordpress.com/2008/03/27/incremental-development-with-monorail-part-two/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 17:58:31 +0000</pubDate>
		<dc:creator>benl</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ALT.NET]]></category>
		<category><![CDATA[Castle]]></category>
		<category><![CDATA[Monorail]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[TestDrivenDevelopment]]></category>

		<guid isPermaLink="false">http://benl.wordpress.com/2008/03/27/incremental-development-with-monorail-part-two/</guid>
		<description><![CDATA[Part one can be found here.
So in part one we had finished up at a failing test. Lets recap what this was:
 
And our failing test:
 
Our add view assumes that a Save action exists on our PostController. In attempting to make the test above pass, we will introduce this new action. However, this will [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=267&subd=benl&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://benl.wordpress.com/2008/03/27/incremental-development-with-monorail/">Part one can be found here.</a></p>
<p>So in part one we had finished up at a failing test. Lets recap what this was:</p>
<p><a href="http://benl.files.wordpress.com/2008/03/145.png"><img style="border-width:0;" height="24" alt="14" src="http://benl.files.wordpress.com/2008/03/14-thumb4.png?w=508&#038;h=24" width="508" border="0"></a> </p>
<p>And our failing test:</p>
<p><a href="http://benl.files.wordpress.com/2008/03/95.png"><img style="border-width:0;" height="274" alt="9" src="http://benl.files.wordpress.com/2008/03/9-thumb4.png?w=508&#038;h=274" width="508" border="0"></a> </p>
<p>Our <strong>add </strong>view assumes that a <strong>Save </strong>action exists on our <strong>PostController</strong>. In attempting to make the test above pass, we will introduce this new action. However, this will be driven out from the <strong>PostController&#8217;s </strong>test fixture like so:</p>
<p><a href="http://benl.files.wordpress.com/2008/03/151.png"><img style="border-width:0;" height="209" alt="15" src="http://benl.files.wordpress.com/2008/03/15-thumb.png?w=508&#038;h=209" width="508" border="0"></a> </p>
<p>We&#8217;re faced with a bunch of unimplemented types and members shown in red thanks to Resharper&#8217;s error highlighting. As you can see from the test we&#8217;ve introduced the <strong>AddPostRequestDto</strong> and the three properties it exposes. Secondly we&#8217;ve introduced the <strong>Save </strong>action to the <strong>PostController </strong>that accepts our <strong>AddPostRequestDto</strong>. Our test then simply asserts that the correct response was set and that the <strong>postcreated </strong>view is displayed.</p>
<p>Our first step is the implementation of the <strong>AddPostRequestDto. </strong>Thankfully Resharper will perform this for us<strong>:</strong></p>
<p><strong><a href="http://benl.files.wordpress.com/2008/03/161.png"><img style="border-width:0;" height="522" alt="16" src="http://benl.files.wordpress.com/2008/03/16-thumb.png?w=508&#038;h=522" width="508" border="0"></a>&nbsp;</strong></p>
<p>We&#8217;ve added this new type to the <strong>Core </strong>project under a new <strong>Messages </strong>namespace and folder for organisation.</p>
<p>Lets now go ahead and implement the new <strong>Save </strong>action on the <strong>PostController:</strong></p>
<p><a href="http://benl.files.wordpress.com/2008/03/171.png"><img style="border-width:0;" height="83" alt="17" src="http://benl.files.wordpress.com/2008/03/17-thumb.png?w=508&#038;h=83" width="508" border="0"></a> </p>
<p>As you can no doubt see, we&#8217;ve done only the simplest thing possible to pass the test. Lets run our tests and see the results:</p>
<p><a href="http://benl.files.wordpress.com/2008/03/18.png"><img style="border-width:0;" height="48" alt="18" src="http://benl.files.wordpress.com/2008/03/18-thumb.png?w=508&#038;h=48" width="508" border="0"></a> </p>
<p>Well our controller fixtures pass nicely. I&#8217;ve got a sneaky suspicion that our acceptance test might fail however:</p>
<p><a href="http://benl.files.wordpress.com/2008/03/19.png"><img style="border-width:0;" height="25" alt="19" src="http://benl.files.wordpress.com/2008/03/19-thumb.png?w=508&#038;h=25" width="508" border="0"></a> </p>
<p>The expected confirmation was not displayed! We can assume this is as we&#8217;ve yet to create the <strong>postcreated </strong>view and spat back the <strong>responseMessage </strong>from this. Lets go ahead and create the view now:</p>
<p>&nbsp;<a href="http://benl.files.wordpress.com/2008/03/20.png"><img style="border-width:0;" height="51" alt="20" src="http://benl.files.wordpress.com/2008/03/20-thumb.png?w=508&#038;h=51" width="508" border="0"></a> </p>
<p>If I run the test again, in the very short time the browser is visible I can see that we&#8217;re failing with an exception occurring during the Monorail binding. To fix this we need to derive the <strong>PostController</strong>&nbsp; from Monorail&#8217;s <strong>SmartDispatcherController</strong> and add the <strong>DataBind </strong>attribute to the <strong>Save </strong>action&#8217;s only parameter:</p>
<p><a href="http://benl.files.wordpress.com/2008/03/211.png"><img style="border-width:0;" height="216" alt="21" src="http://benl.files.wordpress.com/2008/03/21-thumb.png?w=508&#038;h=216" width="508" border="0"></a> </p>
<p>So lets go ahead and run our whole test suite:</p>
<p><a href="http://benl.files.wordpress.com/2008/03/221.png"><img style="border-width:0;" height="43" alt="22" src="http://benl.files.wordpress.com/2008/03/22-thumb.png?w=508&#038;h=43" width="508" border="0"></a> </p>
<p>Sweet! How functional our application is at this stage is still pretty debatable but we&#8217;re getting there <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Our next task is to actually step down a layer and introduce a service to handle our persistence. I&#8217;ve checked in the latest changes. Stay tuned for the next post.</p>
<p>The google code hosted project: <a title="http://code.google.com/p/mr-blogengine/" href="http://code.google.com/p/mr-blogengine/">http://code.google.com/p/mr-blogengine/</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/benl.wordpress.com/267/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/benl.wordpress.com/267/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benl.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benl.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benl.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benl.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benl.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benl.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benl.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benl.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benl.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benl.wordpress.com/267/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benl.wordpress.com&blog=178045&post=267&subd=benl&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://benl.wordpress.com/2008/03/27/incremental-development-with-monorail-part-two/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/146e52d49d361f85c0945487452fc6a0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ben</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/14-thumb4.png" medium="image">
			<media:title type="html">14</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/9-thumb4.png" medium="image">
			<media:title type="html">9</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/15-thumb.png" medium="image">
			<media:title type="html">15</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/16-thumb.png" medium="image">
			<media:title type="html">16</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/17-thumb.png" medium="image">
			<media:title type="html">17</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/18-thumb.png" medium="image">
			<media:title type="html">18</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/19-thumb.png" medium="image">
			<media:title type="html">19</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/20-thumb.png" medium="image">
			<media:title type="html">20</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/21-thumb.png" medium="image">
			<media:title type="html">21</media:title>
		</media:content>

		<media:content url="http://benl.files.wordpress.com/2008/03/22-thumb.png" medium="image">
			<media:title type="html">22</media:title>
		</media:content>
	</item>
	</channel>
</rss>