Permalink
Browse files

Fixing delegate tests

Adding all required Unity dlls so we can test them properly
  • Loading branch information...
1 parent 45dcef6 commit 7ba05f5c9b60e048f25255f2b2262b339e2873a2 @ayende committed Sep 9, 2009
@@ -57,16 +57,17 @@ public void SetUp()
public void CallingMockedDelegatesWithoutOn()
{
ObjectDelegateWithNoParams d1 = (ObjectDelegateWithNoParams)mocks.StrictMock(typeof(ObjectDelegateWithNoParams));
- //Expect.Call(d1()).Return(1);
+ Expect.Call(d1()).Return(1);
- //mocks.ReplayAll();
+ mocks.ReplayAll();
- //Assert.AreEqual(1, d1());
+ Assert.AreEqual(1, d1());
}
[Test]
public void MockTwoDelegatesWithTheSameName()
{
+ SetUp();
ObjectDelegateWithNoParams d1 = (ObjectDelegateWithNoParams)mocks.StrictMock(typeof(ObjectDelegateWithNoParams));
Tests.ObjectDelegateWithNoParams d2 = (Tests.ObjectDelegateWithNoParams)mocks.StrictMock(typeof(Tests.ObjectDelegateWithNoParams));
@@ -783,11 +783,12 @@ private object MockDelegate(CreateMockState mockStateFactory, Type type)
RhinoInterceptor interceptor = new RhinoInterceptor(this, proxyInstance);
Type[] types = new Type[] { typeof(IMockedObject) };
+ var delegateTargetInterface = delegateTargetInterfaceCreator.GetDelegateTargetInterface(type);
object target = GetProxyGenerator(type).CreateInterfaceProxyWithoutTarget(
- delegateTargetInterfaceCreator.GetDelegateTargetInterface(type),
+ delegateTargetInterface,
types, proxyGenerationOptions, interceptor);
- proxy = Delegate.CreateDelegate(type, target, "Invoke");
+ proxy = Delegate.CreateDelegate(type, target, delegateTargetInterface.Name+ ".Invoke");
delegateProxies.Add(target, proxy);
IMockState value = mockStateFactory(GetMockedObject(proxy));
Binary file not shown.
Oops, something went wrong.

0 comments on commit 7ba05f5

Please sign in to comment.