views:

16

answers:

1

Here's my test code:

var container = MockRepository.GenerateMock<UnityContainer>();
container.Expect(e => e.RegisterType<IEventAggregator, EventAggregator>(
   Arg<ContainerControlledLifetimeManager>.Is.Anything));

Basically I'm going to assert that a class that takes a IUnityContainer interface sets up the container in an expected way.

The problem is that RhinoMocks thinks I'm trying to call this method on the container:

RegisterType(Type from, Type to, String name, 
   LifetimeManager lifetimeManager, InjectionMember[] injectionMembers)

But if I "go to definition" in Visual Studio, it goes to the right place:

RegisterType<TFrom, TTo>(LifetimeManager lifetimeManager, 
   params InjectionMember[] injectionMembers)

What's the magic sauce I need to do to get this mocked correctly?

Thanks, Jason

A: 

Never mind! Stupid extension methods :)

RegisterType is an extension from UnityContainerExtensions. No wonder I couldn't mock it :)

Jason Bock