public void ExecuteWithStaticMethod() { // Arrange MethodContainer container = new MethodContainer(); object[] parameters = new object[0]; MethodInfo methodInfo = typeof(MethodContainer).GetMethod("StaticMethod"); MethodDispatcher dispatcher = new MethodDispatcher(methodInfo); // Act object returnValue = dispatcher.Execute(container, parameters); // Assert Assert.AreEqual(89, returnValue); }
public void ExecuteWithVoidInstanceMethod() { // Arrange MethodContainer container = new MethodContainer(); object[] parameters = new object[] { 5, "some string", new DateTime(2001, 1, 1) }; MethodInfo methodInfo = typeof(MethodContainer).GetMethod("VoidMethod"); MethodDispatcher dispatcher = new MethodDispatcher(methodInfo); // Act object returnValue = dispatcher.Execute(container, parameters); // Assert Assert.IsNull(returnValue); Assert.AreEqual(5, container._i); Assert.AreEqual("some string", container._s); Assert.AreEqual(new DateTime(2001, 1, 1), container._dt); }