Skip to content
This repository has been archived by the owner on Oct 21, 2018. It is now read-only.

Commit

Permalink
Fixing delegate tests
Browse files Browse the repository at this point in the history
Adding all required Unity dlls so we can test them properly
  • Loading branch information
ayende committed Sep 9, 2009
1 parent 45dcef6 commit 7ba05f5
Show file tree
Hide file tree
Showing 6 changed files with 6,166 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Rhino.Mocks.Tests/MockingDelegatesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
5 changes: 3 additions & 2 deletions Rhino.Mocks/MockRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Binary file added SharedLibs/Microsoft.Practices.ObjectBuilder2.dll
Binary file not shown.
Loading

0 comments on commit 7ba05f5

Please sign in to comment.