Agreed. Although it has to be said, most beginners make this mistake(ie.
mocking something that does not need mocking or could otherwise be cheaply
created or instantiated). Other times people might not have the luxury of
working with code where testing was a consideration or SOC and SRP was
violated every step of the way. Who knows! :)
I did enjoy reading this thread though!

On 10 May 2011 14:34, bill richards <[email protected]> wrote:

> Gavin,
>
> This IS the solution if one absolutely must mock something which
> cannot itself be mocked, however, as already pointed out, there is
> absolutely no reason why one would have to mock this item, the object
> itself (XElement) is very light-weight, and it is much simpler to
> instantiate it and populate it with the required data than it is to go
> through the whole process you have outlined, because of course, your
> wrapper would need to be properly tested, and in the testing of that
> you might then find that you absolutely must mock the XElement, and
> then where do we go? lol.
>
>
> On May 10, 2:14 pm, Gavin van der Merwe <[email protected]>
> wrote:
> > If you need to mock XElement perhaps you could create an
> XElementDecorator
> > where the members and properties are set up to use the underlying
> XElement
> > as a backing store and then mark the members virtual in the decorator
> itself
> > (which would facilitate the ability to mock). This would allow you to do
> > what you need to do except there is a bit of overhead in converting these
> > elements to and from the decorator type which could prove to be a pain
> > altogether. Maybe if you used an implicit operator to convert between
> > XElement and XElementDecorator that would alleviate some of the overhead
> but
> > not all of it.
> >
>
> --
> 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.
>
>

-- 
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