<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://codeprairie.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>chrisortman : monorail</title><link>http://codeprairie.net/blogs/chrisortman/archive/tags/monorail/default.aspx</link><description>Tags: monorail</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Testing Helpers in MonoRail</title><link>http://codeprairie.net/blogs/chrisortman/archive/2007/10/24/testing-helpers-in-monorail.aspx</link><pubDate>Thu, 25 Oct 2007 05:44:35 GMT</pubDate><guid isPermaLink="false">73a4aa19-1c0c-4438-a31e-8c1402e1ba60:276</guid><dc:creator>chrisortman</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codeprairie.net/blogs/chrisortman/rsscomments.aspx?PostID=276</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codeprairie.net/blogs/chrisortman/commentapi.aspx?PostID=276</wfw:comment><comments>http://codeprairie.net/blogs/chrisortman/archive/2007/10/24/testing-helpers-in-monorail.aspx#comments</comments><description>&lt;p&gt;I have a helper that generates some links and wanted to be able to test that functionality. The difficult thing is that the helper delgates to UrlHelper which Delegates to Controller and to UrlBuilder.&lt;/p&gt; &lt;p&gt;Thanks to the new testing functionality in MonoRail this was quite easy&lt;/p&gt; &lt;p&gt;Heres&amp;#39;s part of my test fixture.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre&gt;[TestFixture]
&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; NavigationHelperFixtures : Castle.MonoRail.TestSupport.BaseControllerTest {
	&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; NavigationHelper helper;
	&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; TestController controller;
	[SetUp]
	&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Setup() {			
		helper = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; NavigationHelper();
		controller = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TestController();
		PrepareController(controller, &amp;quot;&lt;span style="color:#8b0000;"&gt;test&lt;/span&gt;&amp;quot;, &amp;quot;&lt;span style="color:#8b0000;"&gt;index&lt;/span&gt;&amp;quot;);
		helper.SetController(controller);
	}
}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;This will let me call my helper methods that call UrlHelper without problems.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:955ab8b6-91e3-4890-9fa1-8619a356323c" style="padding-right:0px;display:inline;padding-left:0px;padding-bottom:0px;margin:0px;padding-top:0px;"&gt;Technorati tags: &lt;a href="http://technorati.com/tags/Castle" rel="tag"&gt;Castle&lt;/a&gt;, &lt;a href="http://technorati.com/tags/MonoRail" rel="tag"&gt;MonoRail&lt;/a&gt;&lt;/div&gt;&lt;img src="http://codeprairie.net/aggbug.aspx?PostID=276" width="1" height="1"&gt;</description><category domain="http://codeprairie.net/blogs/chrisortman/archive/tags/monorail/default.aspx">monorail</category></item></channel></rss>