﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Bahador commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>We should not forbid setting expectations on stubs. I know stubs are not mocks, but there are times that I want to just check if a method on a stub is called or not. 
  
So +1 for throwing if any expectations is not set.
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment12</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment12</guid><pubDate>Mon, 30 Jun 2008 19:29:14 GMT</pubDate></item><item><title>Glenn Kees commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>I am in agreement with Jeremy.  If the person crafting the test is a making a call to verify expectations but they have not set any then an exception should be thrown.  Perhaps in this case it should throw new NoExpectationsSet(); (to steal a line from Scott's playbook).
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment11</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment11</guid><pubDate>Sun, 29 Jun 2008 18:02:07 GMT</pubDate></item><item><title>Ben Hall commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>It's a shame the stub object has this method, ideally they wouldn't. If this can't be changed then Scott's suggestion of throwing an StubsAreNotMocksException();  seems the most logical so they don't end up writing bad tests.
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment10</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment10</guid><pubDate>Sun, 29 Jun 2008 15:59:33 GMT</pubDate></item><item><title>Ayende Rahien commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>Sidar,
  
VerifyAllExpectation is an extension method on object, therefor, stubs get it as well
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment9</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment9</guid><pubDate>Sun, 29 Jun 2008 13:48:35 GMT</pubDate></item><item><title>Sidar Ok commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>Why does generate stub return a type that has the ability related to verification at all ? Can't we discard the method at all from generated stub?
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment8</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment8</guid><pubDate>Sun, 29 Jun 2008 10:24:38 GMT</pubDate></item><item><title>Scott Hanselman commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>throw new StubsAreNotMocksException();
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment7</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment7</guid><pubDate>Sun, 29 Jun 2008 07:29:19 GMT</pubDate></item><item><title>Ayende Rahien commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>a) user may assume that this is a valid thing to do.
  
b) this is a bad test design
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment6</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment6</guid><pubDate>Sun, 29 Jun 2008 04:45:37 GMT</pubDate></item><item><title>Tim Barcz commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>Why throw?  If you say make it difficult to do the incorrect thing, wouldn't a no-op be better than a thrown exception.  In other words if the "wrong" thing has no side-effect (being a no-op), why is it the wrong thing at all?
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment5</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment5</guid><pubDate>Sun, 29 Jun 2008 04:33:08 GMT</pubDate></item><item><title>Jeremy Gray commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>Upon further thought while reading the subsequent post on the behaviour of stubs versus mocks, I think I need to clarify my "+1 for throwing" to instead say:
  
  
+1 for throwing from VerifyAllExpectations calls on stubs and mocks that do not have any expectations set on them.
  
  
(That way my preference is consistent regardless of how the whole stubs versus mocks behaviour thing goes ;)
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment4</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment4</guid><pubDate>Sun, 29 Jun 2008 03:12:42 GMT</pubDate></item><item><title>Jeremy Gray commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>+1 for throwing
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment3</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment3</guid><pubDate>Sun, 29 Jun 2008 03:07:18 GMT</pubDate></item><item><title>Matt Hinze commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>Throw.  Make it difficult to do the incorrect thing..
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment2</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment2</guid><pubDate>Sun, 29 Jun 2008 02:49:52 GMT</pubDate></item><item><title>Chad Myers commented on Rhino Mocks 3.5 Design Decisions: To be strict or not?</title><description>I say "Yes, throw" or at least make it the default option.
  
  
I would say that the developer might be confused here about what a Stub does and so is trying to use it incorrectly. They will likely get a false positive in their test and continue on without any indication there's a problem.
</description><link>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment1</link><guid>http://ayende.com/3383/rhino-mocks-3-5-design-decisions-to-be-strict-or-not#comment1</guid><pubDate>Sun, 29 Jun 2008 02:47:46 GMT</pubDate></item></channel></rss>