<?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>Mon, 16 Jan 2012 14:42:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.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>&lt;p&gt;I may add that the following lambda can be shortened significantly:&lt;/p&gt;

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

&lt;p&gt;to&lt;/p&gt;

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

&lt;p&gt;(no need to do the var neither the return :))&lt;/p&gt;
</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; {
var order = new Order() { OrderId = id };
return order;
});</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>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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).&lt;/p&gt;
</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>&lt;p&gt;[...] 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. [...]&lt;/p&gt;
</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;p&gt;&lt;strong&gt;Using Moq to Implement Tests (and Avoid Stubs) &#124; Adventures in HttpContext...&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thank you for submitting this cool story - Trackback from DotNetShoutout...&lt;/p&gt;
</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>

