<?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: Using Moq to Implement Tests (and Avoid Stubs)</title>
	<atom:link href="http://www.michaelhamrah.com/blog/2009/02/using-moq-3-to-implement-tests-and-avoid-stubs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michaelhamrah.com/blog/2009/02/using-moq-3-to-implement-tests-and-avoid-stubs/</link>
	<description>All the stuff after "Hello, World!"</description>
	<lastBuildDate>Thu, 02 Sep 2010 15:57:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Daniel Cazzulino</title>
		<link>http://www.michaelhamrah.com/blog/2009/02/using-moq-3-to-implement-tests-and-avoid-stubs/comment-page-1/#comment-66</link>
		<dc:creator>Daniel Cazzulino</dc:creator>
		<pubDate>Fri, 27 Feb 2009 04:44:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.michaelhamrah.com/blog/?p=145#comment-66</guid>
		<description>I may add that the following lambda can be shortened significantly:

mockOrderStorage.Setup(os =&gt; os.GetOrder(It.IsAny())).Returns((int id) =&gt; {
var order = new Order() { OrderId = id };
return order;
});

to

mockOrderStorage.Setup(os =&gt; os.GetOrder(It.IsAny())).Returns((int id) =&gt; new Order { OrderId = id });

(no need to do the var neither the return :))</description>
		<content:encoded><![CDATA[<p>I may add that the following lambda can be shortened significantly:</p>
<p>mockOrderStorage.Setup(os =&gt; os.GetOrder(It.IsAny())).Returns((int id) =&gt; {<br />
var order = new Order() { OrderId = id };<br />
return order;<br />
});</p>
<p>to</p>
<p>mockOrderStorage.Setup(os =&gt; os.GetOrder(It.IsAny())).Returns((int id) =&gt; new Order { OrderId = id });</p>
<p>(no need to do the var neither the return <img src='http://www.michaelhamrah.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wekempf</title>
		<link>http://www.michaelhamrah.com/blog/2009/02/using-moq-3-to-implement-tests-and-avoid-stubs/comment-page-1/#comment-63</link>
		<dc:creator>wekempf</dc:creator>
		<pubDate>Thu, 26 Feb 2009 15:19:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.michaelhamrah.com/blog/?p=145#comment-63</guid>
		<description>Looks like you read the Martin Fowler article, and failed to understand it.  Your test uses a stub, not a mock.  According to Fowler, the big difference is in what your testing.  With a Stub, your testing state.  With a Mock, your testing behavior.  You didn&#039;t care if GetOrder was called, you only cared about the result (state) of the call to ShipOrder.  This means you used a stub, regardless of whether or not the Moq uses Mock as the type name here.

You seem to equate stubs with hand coded classes and mocks with runtime generated objects.  This isn&#039;t accurate, and either can be either hand coded or generated (runtime or compile time).</description>
		<content:encoded><![CDATA[<p>Looks like you read the Martin Fowler article, and failed to understand it.  Your test uses a stub, not a mock.  According to Fowler, the big difference is in what your testing.  With a Stub, your testing state.  With a Mock, your testing behavior.  You didn&#8217;t care if GetOrder was called, you only cared about the result (state) of the call to ShipOrder.  This means you used a stub, regardless of whether or not the Moq uses Mock as the type name here.</p>
<p>You seem to equate stubs with hand coded classes and mocks with runtime generated objects.  This isn&#8217;t accurate, and either can be either hand coded or generated (runtime or compile time).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #295</title>
		<link>http://www.michaelhamrah.com/blog/2009/02/using-moq-3-to-implement-tests-and-avoid-stubs/comment-page-1/#comment-60</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #295</dc:creator>
		<pubDate>Thu, 26 Feb 2009 07:39:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.michaelhamrah.com/blog/?p=145#comment-60</guid>
		<description>[...] Using Moq to Implement Tests (and Avoid Stubs)  - Michael Hamrah talks about the use of the Moq framework in testing, and talks about preferring Mocks over stubs when testing. [...]</description>
		<content:encoded><![CDATA[<p>[...] Using Moq to Implement Tests (and Avoid Stubs)  &#8211; Michael Hamrah talks about the use of the Moq framework in testing, and talks about preferring Mocks over stubs when testing. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DotNetShoutout</title>
		<link>http://www.michaelhamrah.com/blog/2009/02/using-moq-3-to-implement-tests-and-avoid-stubs/comment-page-1/#comment-58</link>
		<dc:creator>DotNetShoutout</dc:creator>
		<pubDate>Wed, 25 Feb 2009 19:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.michaelhamrah.com/blog/?p=145#comment-58</guid>
		<description>&lt;strong&gt;Using Moq to Implement Tests (and Avoid Stubs) &#124; Adventures in HttpContext...&lt;/strong&gt;

Thank you for submitting this cool story - Trackback from DotNetShoutout...</description>
		<content:encoded><![CDATA[<p><strong>Using Moq to Implement Tests (and Avoid Stubs) | Adventures in HttpContext&#8230;</strong></p>
<p>Thank you for submitting this cool story &#8211; Trackback from DotNetShoutout&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
