[Ironruby-core] Mocking behavior between clr types

Ivan Porto Carrero ivan at flanders.co.nz
Sun Jan 24 15:34:52 EST 2010


You don't need to do anything as drastic as disassemble dlls though :).
There are several solutions and I think the cleanest one is to use the CLR
profiling API.  Another avenue I could take is to use Mono.Cecil but I don't
like the idea of the IL rewriting stuff. heck even postsharp would probably
do the trick.

I need to look into the CLR profiling API to make the rest of the stuff
happening as that is the cleanest solution IMO. The limitation only exists
if you're mocking CLR classes for use in other CLR classes. If you're going
to use it in ruby code you can do whatever you want.

My mocker does most of what Moq and Rhino.Mocks do, except that it doesn't
use LCG or expression trees but just the reflection API once per type. from
there on out it uses ruby to do its job.

What I need to add but don't know if they are really necessary are call
count constraints.
And I also want to make the RSpec integration a little bit better so that
you can enlist an expectation for verification too.

The docs are a bit outdated too, best is to look into spec/bacon/integration
that's where I test out the new features or syntax additions.
I have a chapter in my book that explains the use of Caricature with RSpec
which will be in the update at the end of january. Contact me off list if
you want a discount :)

---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)



On Sun, Jan 24, 2010 at 8:16 PM, andrew Wilson <a.wilson82 at gmail.com> wrote:

> Ivan,
>
> Seems like a what I was looking for, however according to the documentation
> it says it can only mock virtuals and non-static though.
>
> I don't want that restriction :(  One of the advantages I was hoping to
> leverage was the ability to re-write methods that I wouldn't otherwise be
> able to.
>
>
> -A
>
> --
> When I wrote this, only God and I understood what I was doing.  Now, God
> only knows - Karl Weierstrass
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100124/8a67fda1/attachment.html>


More information about the Ironruby-core mailing list