public void ShouldDisposeInvokeTest() { MockAspectDynamicInvoker mockAspectDynamicInvoker; object proxyInstance; Type proxiedType; MethodInfo invokedMethodInfo; object[] invocationParameters; object returnValue; proxyInstance = new object(); proxiedType = typeof(IDisposable); invokedMethodInfo = (MethodInfo)MemberInfoProxy<IDisposable>.GetLastMemberInfo(exec => exec.Dispose()); invocationParameters = new object[] { }; mockAspectDynamicInvoker = new MockAspectDynamicInvoker(); returnValue = mockAspectDynamicInvoker.Invoke(proxiedType, invokedMethodInfo, proxyInstance, invocationParameters); Assert.IsNull(returnValue); Assert.IsFalse(mockAspectDynamicInvoker.Disposed); }
public void ShouldCloneInvokeTest() { MockAspectDynamicInvoker mockAspectDynamicInvoker; object proxyInstance; Type proxiedType; MethodInfo invokedMethodInfo; object[] invocationParameters; object returnValue; proxyInstance = new object(); proxiedType = typeof(ICloneable); invokedMethodInfo = (MethodInfo)MemberInfoProxy<ICloneable>.GetLastMemberInfo(exec => exec.Clone()); invocationParameters = new object[] { }; mockAspectDynamicInvoker = new MockAspectDynamicInvoker(); returnValue = mockAspectDynamicInvoker.Invoke(proxiedType, invokedMethodInfo, proxyInstance, invocationParameters); Assert.IsNull(returnValue); Assert.AreEqual("ICloneable::Clone", mockAspectDynamicInvoker.lastOperationName); }
public void ShouldFailOnDisposedInvokeTest() { MockAspectDynamicInvoker mockAspectDynamicInvoker; object proxyInstance; Type proxiedType; MethodInfo invokedMethodInfo; object[] invocationParameters; object returnValue; proxyInstance = new object(); proxiedType = typeof(IMockObject); invokedMethodInfo = (MethodInfo)MemberInfoProxy<IMockObject>.GetLastMemberInfo(exec => exec.ToString()); invocationParameters = new object[] { }; mockAspectDynamicInvoker = new MockAspectDynamicInvoker(new MockObject()); mockAspectDynamicInvoker.Dispose(); returnValue = mockAspectDynamicInvoker.Invoke(proxiedType, invokedMethodInfo, proxyInstance, invocationParameters); }
public void ShouldNotFailOnDoubleDisposeTest() { MockAspectDynamicInvoker mockAspectDynamicInvoker; mockAspectDynamicInvoker = new MockAspectDynamicInvoker(); Assert.IsNotNull(mockAspectDynamicInvoker); mockAspectDynamicInvoker.Dispose(); mockAspectDynamicInvoker.Dispose(); }
public void ShouldFailOnNullMethodInfoInvokeTest() { MockAspectDynamicInvoker mockAspectDynamicInvoker; object proxyInstance; Type proxiedType; MethodInfo invokedMethodInfo; object[] invocationParameters; proxyInstance = new object(); proxiedType = typeof(IMockObject); invokedMethodInfo = null; invocationParameters = new object[] { }; mockAspectDynamicInvoker = new MockAspectDynamicInvoker(); mockAspectDynamicInvoker.Invoke(proxiedType, invokedMethodInfo, proxyInstance, invocationParameters); }
public void ShouldFailOnNullInvokingTypeInvokeTest() { MockAspectDynamicInvoker mockAspectDynamicInvoker; object proxyInstance; Type proxiedType; MethodInfo invokedMethodInfo; object[] invocationParameters; proxyInstance = new object(); proxiedType = null; invokedMethodInfo = (MethodInfo)MemberInfoProxy<IMockObject>.GetLastMemberInfo(exec => exec.ToString()); invocationParameters = new object[] { }; mockAspectDynamicInvoker = new MockAspectDynamicInvoker(); mockAspectDynamicInvoker.Invoke(proxiedType, invokedMethodInfo, proxyInstance, invocationParameters); }