<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How To Write Testable ASP.NET WebForms</title>
	<atom:link href="http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Sat, 13 Mar 2010 21:19:34 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: The Inquisitive Coder - Davy Brion&#8217;s Blog &#187; Blog Archive &#187; How To Write Testable ASP.NET UserControls</title>
		<link>http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/comment-page-1/#comment-3426</link>
		<dc:creator>The Inquisitive Coder - Davy Brion&#8217;s Blog &#187; Blog Archive &#187; How To Write Testable ASP.NET UserControls</dc:creator>
		<pubDate>Sat, 11 Oct 2008 15:28:31 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=160#comment-3426</guid>
		<description>[...] How To Write Testable ASP.NET WebForms [...]</description>
		<content:encoded><![CDATA[<p>[...] How To Write Testable ASP.NET WebForms [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ulu</title>
		<link>http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/comment-page-1/#comment-1495</link>
		<dc:creator>ulu</dc:creator>
		<pubDate>Fri, 29 Aug 2008 20:06:42 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=160#comment-1495</guid>
		<description>I don&#039;t think the example is too easy. I think it&#039;s too complicated, and the main point (extract as much code as you can from the View into the Controller, then test the Controller, since you can&#039;t test the View) is obscured by the complexity. At the end, you still have a lot of code in the View that&#039;s untested.

Things start to get even more complicated when you need cookies or Http caching.

I&#039;m writing all this, of course, because I want to advertise a solution. You might want to take a look at Ivonna (http://sm-art.biz/Ivonna.aspx), which lets you unit test WebForm pages in the context of the Web request, yet it is different from client-side tools like Selenium in that you can isolate as much dependencies as you need. It doesn&#039;t force any architecture on you, so you can do it the quick and dirty way (in codebehind) and then refactor in small steps to whatever pattern you prefer, or start with a predefined pattern and test-drive your view like you do with the other parts.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think the example is too easy. I think it&#8217;s too complicated, and the main point (extract as much code as you can from the View into the Controller, then test the Controller, since you can&#8217;t test the View) is obscured by the complexity. At the end, you still have a lot of code in the View that&#8217;s untested.</p>
<p>Things start to get even more complicated when you need cookies or Http caching.</p>
<p>I&#8217;m writing all this, of course, because I want to advertise a solution. You might want to take a look at Ivonna (<a href="http://sm-art.biz/Ivonna.aspx" rel="nofollow">http://sm-art.biz/Ivonna.aspx</a>), which lets you unit test WebForm pages in the context of the Web request, yet it is different from client-side tools like Selenium in that you can isolate as much dependencies as you need. It doesn&#8217;t force any architecture on you, so you can do it the quick and dirty way (in codebehind) and then refactor in small steps to whatever pattern you prefer, or start with a predefined pattern and test-drive your view like you do with the other parts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Useful Links #9 &#124; GrantPalin.com</title>
		<link>http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/comment-page-1/#comment-656</link>
		<dc:creator>Useful Links #9 &#124; GrantPalin.com</dc:creator>
		<pubDate>Sun, 13 Jul 2008 22:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=160#comment-656</guid>
		<description>[...] How To Write Testable ASP.NET WebForms A cornerstone of the MVC framework for ASP.NET is that it is easier to unit test than Web Forms. This article shows how to unit test Web Forms as well. [...]</description>
		<content:encoded><![CDATA[<p>[...] How To Write Testable ASP.NET WebForms A cornerstone of the MVC framework for ASP.NET is that it is easier to unit test than Web Forms. This article shows how to unit test Web Forms as well. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/comment-page-1/#comment-585</link>
		<dc:creator>David</dc:creator>
		<pubDate>Wed, 09 Jul 2008 02:53:34 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=160#comment-585</guid>
		<description>Thanks for this Davy. Very helpful post.</description>
		<content:encoded><![CDATA[<p>Thanks for this Davy. Very helpful post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ohad Aston</title>
		<link>http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/comment-page-1/#comment-574</link>
		<dc:creator>Ohad Aston</dc:creator>
		<pubDate>Mon, 07 Jul 2008 16:43:21 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=160#comment-574</guid>
		<description>You can also use &lt;a href=&quot;http://stormwindproject.org/&quot; rel=&quot;nofollow&quot;&gt;NMVP&lt;/a&gt; for creating testable websites (with webforms)</description>
		<content:encoded><![CDATA[<p>You can also use <a href="http://stormwindproject.org/" rel="nofollow">NMVP</a> for creating testable websites (with webforms)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/comment-page-1/#comment-565</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Mon, 07 Jul 2008 04:50:06 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=160#comment-565</guid>
		<description>Right, you could start using this in an existing application as well.. the only thing you need is buy-in from all the devs of the application :)</description>
		<content:encoded><![CDATA[<p>Right, you could start using this in an existing application as well.. the only thing you need is buy-in from all the devs of the application <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ASP.NET MVC Archived Buzz, Page 1</title>
		<link>http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/comment-page-1/#comment-564</link>
		<dc:creator>ASP.NET MVC Archived Buzz, Page 1</dc:creator>
		<pubDate>Mon, 07 Jul 2008 02:39:21 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=160#comment-564</guid>
		<description>[...] [Del.icio.us] The Inquisitive Coder &quot; Blog Archive &quot; How To Write Testable ASP.NET WebForms (7/6/200...Sunday, July 06, 2008 from darioquintana [...]</description>
		<content:encoded><![CDATA[<p>[...] [Del.icio.us] The Inquisitive Coder &#8221; Blog Archive &#8221; How To Write Testable ASP.NET WebForms (7/6/200&#8230;Sunday, July 06, 2008 from darioquintana [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chad Myers</title>
		<link>http://davybrion.com/blog/2008/07/how-to-write-testable-aspnet-webforms/comment-page-1/#comment-562</link>
		<dc:creator>Chad Myers</dc:creator>
		<pubDate>Mon, 07 Jul 2008 00:56:37 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=160#comment-562</guid>
		<description>Very nice, good stuff. This would definitely make WebForms much more bearable :)

The nice thing is, you could start doing this in an existing/legacy app going forward and slowly migrating the old code over to this structure, right?

One suggestion? In the code-behind, you might consider mapping the events directly to the controller/presenter.

Instead of Page_Load calling Controller.Load(), maybe try overriding OnInit() and call:

this.Load += Controller.Load;
SearchButton.Click = Controller.Search;

Then in add things like &quot;string CurrentName{ get; set;}&quot; to your IProductList view interface which will return NameTextBox.Text&#039;s value.  It&#039;s double-dispatch and it takes even more thinking away from the view (which has always proven to be a good thing in my experience).</description>
		<content:encoded><![CDATA[<p>Very nice, good stuff. This would definitely make WebForms much more bearable <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The nice thing is, you could start doing this in an existing/legacy app going forward and slowly migrating the old code over to this structure, right?</p>
<p>One suggestion? In the code-behind, you might consider mapping the events directly to the controller/presenter.</p>
<p>Instead of Page_Load calling Controller.Load(), maybe try overriding OnInit() and call:</p>
<p>this.Load += Controller.Load;<br />
SearchButton.Click = Controller.Search;</p>
<p>Then in add things like &#8220;string CurrentName{ get; set;}&#8221; to your IProductList view interface which will return NameTextBox.Text&#8217;s value.  It&#8217;s double-dispatch and it takes even more thinking away from the view (which has always proven to be a good thing in my experience).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
