public void CanCreateWithStringParameter() { var sut = new MethodParametersMirror("42"); Assert.IsInstanceOfType(sut, typeof(MethodParametersMirror)); var invocation = MethodInvocation.Invocations.Single(); Assert.AreEqual(".ctor", invocation.MemberName); Assert.AreEqual("42", invocation.Parameters.Single()); Assert.AreEqual(typeof(MethodParametersMirror).GetMirrorClass(), invocation.ContainingType.FullName); }
public void CanInvokeMethodWithUInt32Parameter() { var sut = new MethodParametersMirror(); sut.DoSomething(32); var invocation = MethodInvocation.Invocations.Single(); Assert.AreEqual(nameof(MethodParametersMirror.DoSomething), invocation.MemberName); Assert.AreEqual(32U, invocation.Parameters.Single()); Assert.AreEqual(typeof(MethodParametersMirror).GetMirrorClass(), invocation.ContainingType.FullName); }
public void CanInvokeMethodWithInternalParameterTypes() { var sut = new MethodParametersMirror(); ReturnValueMirror returnValue = sut.DoSomething(new ParameterMirror()); Assert.IsInstanceOfType(returnValue, typeof(ReturnValueMirror)); var invocation = MethodInvocation.Invocations.Single(); Assert.AreEqual(nameof(MethodParametersMirror.DoSomething), invocation.MemberName); Assert.AreEqual(typeof(ParameterMirror).GetMirrorClass(), invocation.Parameters.Single().GetType().FullName); Assert.AreEqual(typeof(MethodParametersMirror).GetMirrorClass(), invocation.ContainingType.FullName); }