[Ironruby-core] Mocking behavior between clr types

Ben Hall ben2004uk at googlemail.com
Sun Jan 24 16:30:33 EST 2010

Hi Ivan,

I was thinking Mono.Cecil first and then the CLR profiling API as I'm
pretty sure that will work. I used a similar approach for
but the fault injection was done via some Microsoft Research stuff.
Either approach your re-writing IL, it just depends which layer you
work with.

Lots of interesting problems to solve. Then it would just need a nice
Ruby wrapper so it's transparent to the end user - ideally
incorporating the backend work into Caricature.


On Sun, Jan 24, 2010 at 8:34 PM, Ivan Porto Carrero <ivan at flanders.co.nz> wrote:
> 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
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core

More information about the Ironruby-core mailing list