Ayende @ Rahien

Unnatural acts on source code

Mocking WCF

Well, the tests for this are passing:

IoC.AddIntegrationWith(

  new WindowsCommunicationFoundation().Behaviors.Add( new RhinoMocks() )

);

:-)

That was tough, but I got it to work in a fashion that I like. This means WCF integration with Windsor, support for mocking WCF services on both ends of the wire and probably a couple other things that I am forgetting. I am in the middle of writing a blog post about it, and I had to stop when I got everything to work just right. That post is already 13 pages long, and I just had to post something as things were happening.

 

Comments

Jeremy Miller
02/10/2007 07:12 PM by
Jeremy Miller

I haven't touched WCF/Indigo yet, but wouldn't it just be easier to put an interface on top of WCF and mock that in your unit tests?

And from the previous post, is there anyway to use WCF sans xml?

Ayende Rahien
02/10/2007 07:31 PM by
Ayende Rahien

Yes and no.

I am thinking about it in two ways, first, using WCF Services in unit tests, those are just interfaces in most cases, which means that I can simply mock them.

The second thing is using them in integration tests, where I want to test that the whole of my application is doing what is expected from it when it is encounter various weird stuff from the services it interact with it.

I am going to post shortly about how to do it both ways.

Ayende Rahien
02/10/2007 08:03 PM by
Ayende Rahien

Oh, and it most definitely can be configured from code and not just XML.

Check here for the full details;

http://ayende.com/Blog/archive/2007/02/10/WCF-Mocking-and-IoC-Oh-MY.aspx

Comments have been closed on this topic.