> Am not saying Kenneth's way is wrong...but...

As I said I knew many won't agree and I glad to see different opinions. :)

> Mocking isn't always the answer.  In the case of testing the abstract class,
> it's probably easier/quicker to simply create a "Test Specific Sub-Class"
> (xUnit Test pattern - see
> http://xunitpatterns.com/Test-Specific%20Subclass.html).

I had no choice but writing TSSC in the days when mock framework
wasn't mature. But I found it is tedious rather then quick and easy
especially when come to abstract classes. I found myself writing more
code in TSSC then the test itself. Mocking abstract class making my
test looks much cleaner and easier to understand in most of use cases.
After all, a PartialMock is a Test Specific Sub-Class of the SUT,
isn't it? And as far as I understood, the future Fake in 4.0 will make
it more close to my own TSSC Fakes.

That being said, I do see one drawback of using mock, that is you are
not only testing the SUT, but also the mock framework. Any
bug/limitation in the Mock framework can impact the SUT. But this is
true as long as you are using unit test and/or mock framework, doesn't
mater whether you use it for TDS or TSSC.

Do I still write my own TSSC? Yes I do, under certain use cases that
are more appropriate then mock or simply because a bug in mock
framework. For example, I had to hand write TSSC myself when
synchronization is important to me because RhinoMocks changes the
synchronization behavior of class that is being mocked.

> Mocking solves a particluar problem but be wary to avoid the "I'm a hammer
> so everything looks like a nail" syndrome....

I agree not to see every like a nail, but if used properly, hammer can
go well against something other then nails.

Cheers,
Kenneth

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to