<?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: Mocking Dilemma, Solved!</title> <atom:link href="http://davybrion.com/blog/2008/07/mocking-dilemma-solved/feed/" rel="self" type="application/rss+xml" /><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/</link> <description>inquisitive: adjective. given to inquiry, research, or asking questions; eager for knowledge; intellectually curious</description> <lastBuildDate>Sun, 05 Feb 2012 21:55: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: Davy Brion</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-835</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Tue, 22 Jul 2008 12:48:12 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-835</guid> <description>don&#039;t worry Rob, Moq is still on my TODO list :)along with a bunch of other things unfortunately :s</description> <content:encoded><![CDATA[<p>don&#8217;t worry Rob, Moq is still on my TODO list <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>along with a bunch of other things unfortunately :s</p> ]]></content:encoded> </item> <item><title>By: Dew Drop - July 22, 2008 &#124; Alvin Ashcraft's Morning Dew</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-834</link> <dc:creator>Dew Drop - July 22, 2008 &#124; Alvin Ashcraft's Morning Dew</dc:creator> <pubDate>Tue, 22 Jul 2008 12:00:33 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-834</guid> <description>[...] Mocking Dilemma, Solved! (Davy Brion) [...]</description> <content:encoded><![CDATA[<p>[...] Mocking Dilemma, Solved! (Davy Brion) [...]</p> ]]></content:encoded> </item> <item><title>By: Rob</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-832</link> <dc:creator>Rob</dc:creator> <pubDate>Tue, 22 Jul 2008 11:43:52 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-832</guid> <description>Moq has a support for protected methods. You can&#039;t use lambdaexpressions with protected methods, but at least it&#039;s supported.</description> <content:encoded><![CDATA[<p>Moq has a support for protected methods. You can&#8217;t use lambdaexpressions with protected methods, but at least it&#8217;s supported.</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-831</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Tue, 22 Jul 2008 10:55:32 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-831</guid> <description>don&#039;t get me started on regions ;)</description> <content:encoded><![CDATA[<p>don&#8217;t get me started on regions <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: Jan Van Ryswyck</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-830</link> <dc:creator>Jan Van Ryswyck</dc:creator> <pubDate>Tue, 22 Jul 2008 10:52:36 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-830</guid> <description>It wouldn&#039;t matter for simple scenarios (e.g. on or two template methods). You can always hide the dirt behind a region :-).  For more complex scenarios, Tom&#039;s approach seems more feasible.</description> <content:encoded><![CDATA[<p>It wouldn&#8217;t matter for simple scenarios (e.g. on or two template methods). You can always hide the dirt behind a region <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .  For more complex scenarios, Tom&#8217;s approach seems more feasible.</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-829</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Tue, 22 Jul 2008 10:37:03 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-829</guid> <description>letting the fixture inherit directly from the abstract class would require the fixture to implement the abstract method. which i didn&#039;t like :)</description> <content:encoded><![CDATA[<p>letting the fixture inherit directly from the abstract class would require the fixture to implement the abstract method. which i didn&#8217;t like <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: den ben</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-828</link> <dc:creator>den ben</dc:creator> <pubDate>Tue, 22 Jul 2008 10:21:51 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-828</guid> <description>@Jan: I see that now (sorry for not reading your comment in depth first).  And that &quot;self shunt&quot; pattern wouldn&#039;t even need a mock at all to be able to do the test (like you said)... which is probably what I would have done.  However, I agree that Tom&#039;s solution is the cleanest ;-)</description> <content:encoded><![CDATA[<p>@Jan: I see that now (sorry for not reading your comment in depth first).  And that &#8220;self shunt&#8221; pattern wouldn&#8217;t even need a mock at all to be able to do the test (like you said)&#8230; which is probably what I would have done.  However, I agree that Tom&#8217;s solution is the cleanest <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: Jan Van Ryswyck</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-826</link> <dc:creator>Jan Van Ryswyck</dc:creator> <pubDate>Tue, 22 Jul 2008 10:02:26 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-826</guid> <description>@Den Ben: Kinda what I meant by using the &quot;self shunt&quot; pattern. Seeing the code and all, it looks nicer this way.</description> <content:encoded><![CDATA[<p>@Den Ben: Kinda what I meant by using the &#8220;self shunt&#8221; pattern. Seeing the code and all, it looks nicer this way.</p> ]]></content:encoded> </item> <item><title>By: den ben</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-825</link> <dc:creator>den ben</dc:creator> <pubDate>Tue, 22 Jul 2008 09:50:43 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-825</guid> <description>ohw.. and the comment dit not allow me to post the
&lt;code&gt;var myObject = mocks.DynamicMock();&lt;/code&gt; correctlyyou need to pass the MyAbstractClassTests type instead of the MyAbstractClassTestWrapper type</description> <content:encoded><![CDATA[<p>ohw.. and the comment dit not allow me to post the<br
/> <code>var myObject = mocks.DynamicMock();</code> correctly</p><p>you need to pass the MyAbstractClassTests type instead of the MyAbstractClassTestWrapper type</p> ]]></content:encoded> </item> <item><title>By: den ben</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-824</link> <dc:creator>den ben</dc:creator> <pubDate>Tue, 22 Jul 2008 09:47:44 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-824</guid> <description>Fantastic solution!But I&#039;m wondering... wouldn&#039;t it be enough to do it as follows:&lt;code&gt;
[TestFixture]
public class MyAbstractClassTests : MyAbstractClass
{
[Test]
public void CallsProtectedAbstractMethod()
{
var mocks = new MockRepository();
var myObject = mocks.DynamicMock();myObject.Expect(m =&gt; m.DoSomethingSpecific()); // &lt;= no more compile errormyObject.Replay();myObject.DoSomethingInteresting();
myObject.VerifyAllExpectations();
}
}
&lt;/code&gt;Won&#039;t this also work?  And if not, what am i missing?</description> <content:encoded><![CDATA[<p>Fantastic solution!</p><p>But I&#8217;m wondering&#8230; wouldn&#8217;t it be enough to do it as follows:</p><p><code><br
/> [TestFixture]<br
/> public class MyAbstractClassTests : MyAbstractClass<br
/> {<br
/> [Test]<br
/> public void CallsProtectedAbstractMethod()<br
/> {<br
/> var mocks = new MockRepository();<br
/> var myObject = mocks.DynamicMock();</p><p> myObject.Expect(m =&gt; m.DoSomethingSpecific()); // &lt;= no more compile error</p><p> myObject.Replay();</p><p> myObject.DoSomethingInteresting();<br
/> myObject.VerifyAllExpectations();<br
/> }<br
/> }<br
/> </code></p><p>Won&#8217;t this also work?  And if not, what am i missing?</p> ]]></content:encoded> </item> <item><title>By: Jan Van Ryswyck</title><link>http://davybrion.com/blog/2008/07/mocking-dilemma-solved/comment-page-1/#comment-821</link> <dc:creator>Jan Van Ryswyck</dc:creator> <pubDate>Tue, 22 Jul 2008 07:08:39 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=199#comment-821</guid> <description>One could also choose for the &quot;self shunt&quot; pattern, where the test fixture itself derives from the abstract base class. This has the disadvantage of being less readable when continuing to use Rhino Mocks for checking whether the abstract method is called. If simplicity is all you need, then no mocks are needed and a simple boolean member variable will do. If the scenario, is more complex, than this is a nice and clean solution.Kind regards,Jan</description> <content:encoded><![CDATA[<p>One could also choose for the &#8220;self shunt&#8221; pattern, where the test fixture itself derives from the abstract base class. This has the disadvantage of being less readable when continuing to use Rhino Mocks for checking whether the abstract method is called. If simplicity is all you need, then no mocks are needed and a simple boolean member variable will do. If the scenario, is more complex, than this is a nice and clean solution.</p><p>Kind regards,</p><p>Jan</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/16 queries in 0.013 seconds using disk: basic
Object Caching 503/506 objects using disk: basic
Content Delivery Network via Amazon Web Services: CloudFront: d18sni7re4ly7f.cloudfront.net

Served from: davybrion.com @ 2012-02-08 05:45:43 -->
