<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.lostechies.com/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>Girl Writes Code (Sharon Cichelli) - All Comments</title><link>http://www.lostechies.com/blogs/sharoncichelli/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75670</link><pubDate>Mon, 22 Mar 2010 05:17:46 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75670</guid><dc:creator>Mathias</dc:creator><description>&lt;p&gt;Great post; I have struggled with exactly the same issue, and Rhino.Mocks API doesn&amp;#39;t help understand the difference between Mocks and Stubs, because they both support the same methods, and stubs fail silently. Personally, the aha moment for me came when I read Roy Osherove&amp;#39;s &amp;quot;The Art of Unit Testing&amp;quot;, where he states that a test could fail because of a Mock, but never because of a Stub. That doesn&amp;#39;t resolve the somewhat ambiguous API issues, but that helps in determining whether what you need is a Mock or a Stub!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75670" width="1" height="1"&gt;</description></item><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75659</link><pubDate>Mon, 22 Mar 2010 02:14:42 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75659</guid><dc:creator>Jon Kruger</dc:creator><description>&lt;p&gt;I updated my original post to fix the problem that you pointed out in this post. &amp;nbsp;Thanks for pointing that out.&lt;/p&gt;
&lt;p&gt;Jon&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75659" width="1" height="1"&gt;</description></item><item><title>Jon Kruger&amp;#8217;s Blog  &amp;raquo; Blog Archive   &amp;raquo; How to use Rhino Mocks - documented through tests</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75658</link><pubDate>Mon, 22 Mar 2010 02:14:03 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75658</guid><dc:creator>Jon Kruger’s Blog  » Blog Archive   » How to use Rhino Mocks - documented through tests</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Jon Kruger&amp;#8217;s Blog &amp;nbsp;&amp;raquo; Blog Archive &amp;nbsp; &amp;raquo; How to use Rhino Mocks - documented through tests&lt;/p&gt;
&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75658" width="1" height="1"&gt;</description></item><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75638</link><pubDate>Sun, 21 Mar 2010 12:56:04 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75638</guid><dc:creator>Thomas Eyde</dc:creator><description>&lt;p&gt;@Arthur, we can always debate whether an api is broken or not. But extension methods can operate on different types. My argument is that GenerateMock and GenerateStub should return different types. When that&amp;#39;s the case, we can have extension methods which only operates on one of the types.&lt;/p&gt;
&lt;p&gt;@Krzysztof, you are correct. It&amp;#39;s easy to make the same mistake in Moq. I don&amp;#39;t use Verify very often, so I didn&amp;#39;t know. In that respect, I should probably refrain from commenting.&lt;/p&gt;
&lt;p&gt;One can also argue that the Moq api is broken. I don&amp;#39;t know the rationale behind Verifiable(), but from where I am sitting, every method should be so by default. It&amp;#39;s up to me to call Verify() at the end.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75638" width="1" height="1"&gt;</description></item><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75604</link><pubDate>Sat, 20 Mar 2010 23:38:59 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75604</guid><dc:creator>Ryan Svihla</dc:creator><description>&lt;p&gt;For the kinds of test I really prefer obj.AssertWasCalled(x=&amp;gt;x.WhateverMethod), Then I can write asserts against specific method calls. &amp;nbsp;Also with this approach I never have to use Expect and I only need Stub for my return values.&lt;/p&gt;
&lt;p&gt;Ayende has examples of the AssertWasCalled approach in many places but here is one:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://ayende.com/Blog/archive/2008/05/16/Rhino-Mocks--Arrange-Act-Assert-Syntax.aspx"&gt;ayende.com/.../Rhino-Mocks--Arrange-Act-Assert-Syntax.aspx&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75604" width="1" height="1"&gt;</description></item><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75496</link><pubDate>Fri, 19 Mar 2010 17:45:11 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75496</guid><dc:creator>Artur Dorochowicz</dc:creator><description>&lt;p&gt;Expect, Assert..., Verify... are implemented as extension methods on object. That&amp;#39;s the only way you can make it work in C#.&lt;/p&gt;
&lt;p&gt;So certainly, Rhino Mocks API is not broken.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75496" width="1" height="1"&gt;</description></item><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75490</link><pubDate>Fri, 19 Mar 2010 14:41:20 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75490</guid><dc:creator>MM</dc:creator><description>&lt;p&gt;@Krzysztof - But don&amp;#39;t you think that this &amp;quot;shortcoming&amp;quot; is a little bit more acceptable in Moq because there is only one type of fake? In Rhino Mocks, stub and mock are distinct types so why even put the verify methods on stubs? I think the Moq documentation makes it fairly clear that Verify() will only verify expectations marked as Verifiable (then again, maybe the Rhino Mocks docs make it clear that you should not verify stubs).&lt;/p&gt;
&lt;p&gt;John Sonmez hit the nail on the head. The bottom is line is that this is a good reminder that we should always make sure that our tests fail when they are supposed to.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75490" width="1" height="1"&gt;</description></item><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75489</link><pubDate>Fri, 19 Mar 2010 14:22:32 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75489</guid><dc:creator>John Sonmez</dc:creator><description>&lt;p&gt;Good catch. &amp;nbsp;I think the bigger problem is though it not this incidence, but of not making sure that a test can fail. &amp;nbsp;I wrote about this here: &lt;a rel="nofollow" target="_new" href="http://simpleprogrammer.com/2010/03/05/the-ego-test/"&gt;simpleprogrammer.com/.../the-ego-test&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I call it an &amp;quot;ego test&amp;quot;, because you can always run it and feel good.&lt;/p&gt;
&lt;p&gt;The only way to really prevent these kinds of problems is to make sure you can make a test fail.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75489" width="1" height="1"&gt;</description></item><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75485</link><pubDate>Fri, 19 Mar 2010 12:51:45 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75485</guid><dc:creator>Jon Kruger</dc:creator><description>&lt;p&gt;Interesting. &amp;nbsp;I was trying to figure out the differences between GenerateStub() and GenerateMock() and you pointed out one that I missed. &amp;nbsp;I know what the difference is between a stub and a mock (from an academic perspective), but in Rhino Mocks I find that I never use GenerateMock(). &amp;nbsp;Now, I don&amp;#39;t ever use Expect() and VerifyAllExpectations(), I prefer AssertWasCalled() instead, but that&amp;#39;s just my preference (and probably why I never found this problem before).&lt;/p&gt;
&lt;p&gt;Looks like I&amp;#39;ll have to go update my code (unless you want to send me a patch!).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75485" width="1" height="1"&gt;</description></item><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75483</link><pubDate>Fri, 19 Mar 2010 11:48:20 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75483</guid><dc:creator>Krzysztof Kozmic</dc:creator><description>&lt;p&gt;Thomas&lt;/p&gt;
&lt;p&gt;You can fall prey to this issue with MoQ as easily as with Rhino Mocks.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Test]&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void Moq()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var mock = new Mock&amp;lt;IFoo&amp;gt;();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mock.Setup( m =&amp;gt; m.GetFoo() ).Returns( 34 );&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//mock.Object.GetFoo();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mock.Verify();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public interface IFoo&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int GetFoo();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;This test will pass although it clearly shouldn&amp;#39;t (it does what I told it to, not what I wanted it to do).&lt;/p&gt;
&lt;p&gt;It&amp;#39;s your choice if you like one framework over another but it has nothing to do with the issue at hand.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75483" width="1" height="1"&gt;</description></item><item><title>re: Rhino Mocks Examples, with a fix</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/03/18/rhino-mocks-examples-with-a-fix.aspx#75478</link><pubDate>Fri, 19 Mar 2010 08:54:32 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:75478</guid><dc:creator>Thomas Eyde</dc:creator><description>&lt;p&gt;Or we can use a mocking framework with a lesser confusing api. My favourite for the moment is Moq. I haven&amp;#39;t used Rhino Mock since its Record / Replay days, and I failed miserably using that pattern. &lt;/p&gt;
&lt;p&gt;I can relate to Stubs aren&amp;#39;t Mocks, but why should the framework care? For me, the test dummy is a stub when I use it as a stub. If I later choose to use it as a mock, then it is a mock.&lt;/p&gt;
&lt;p&gt;We can debate this issue for as long as we want, but the fact remains that the Rhino Mock API is broken: The non-working VerifyAllExpectations()-method should never have been there in the first place.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=75478" width="1" height="1"&gt;</description></item><item><title>re: More Dogs and Bears and Chickens and Things: Invite your colleagues to Pablo's Fiesta</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/02/07/more-dogs-and-bears-and-chickens-and-things-invite-your-colleagues-to-pablo-s-fiesta.aspx#65288</link><pubDate>Wed, 10 Feb 2010 15:37:27 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:65288</guid><dc:creator>Sharon J. Cichelli</dc:creator><description>&lt;p&gt;That&amp;#39;s great, Jeff. I hope you&amp;#39;re inviting your teammates one-on-one, instead of with a mass email. I&amp;#39;ve found, the folks who tend to conclude &amp;quot;oh, that&amp;#39;s not for me,&amp;quot; can be turned around when you reach out to them, talk to them, let them know that you want their ideas to be part of the event. I&amp;#39;m glad you&amp;#39;re motivated to make our profession&amp;#39;s events more inclusive.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=65288" width="1" height="1"&gt;</description></item><item><title>re: More Dogs and Bears and Chickens and Things: Invite your colleagues to Pablo's Fiesta</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/02/07/more-dogs-and-bears-and-chickens-and-things-invite-your-colleagues-to-pablo-s-fiesta.aspx#64503</link><pubDate>Tue, 09 Feb 2010 21:07:23 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:64503</guid><dc:creator>Sharon J. Cichelli</dc:creator><description>&lt;p&gt;Ryan, I checked in with John, and you have not registered. Sorry you&amp;#39;re not available to be there. Thanks for being thoughtful about freeing up the spot. :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=64503" width="1" height="1"&gt;</description></item><item><title>re: More Dogs and Bears and Chickens and Things: Invite your colleagues to Pablo's Fiesta</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/02/07/more-dogs-and-bears-and-chickens-and-things-invite-your-colleagues-to-pablo-s-fiesta.aspx#62900</link><pubDate>Mon, 08 Feb 2010 22:55:04 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:62900</guid><dc:creator>Ryan Riley</dc:creator><description>&lt;p&gt;I&amp;#39;m trying to remember if I already registered or not. I know I intended to awhile back. How can I find out? I need to know as I won&amp;#39;t be able to attend anymore. If I did register, can I pass my registration on to someone else?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=62900" width="1" height="1"&gt;</description></item><item><title>re: More Dogs and Bears and Chickens and Things: Invite your colleagues to Pablo's Fiesta</title><link>http://www.lostechies.com/blogs/sharoncichelli/archive/2010/02/07/more-dogs-and-bears-and-chickens-and-things-invite-your-colleagues-to-pablo-s-fiesta.aspx#62456</link><pubDate>Mon, 08 Feb 2010 17:11:30 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:62456</guid><dc:creator>Jeff</dc:creator><description>&lt;p&gt;Actually, anybody I invite, I invite without regard to race, gender, creed, etc...&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=62456" width="1" height="1"&gt;</description></item></channel></rss>