public void CollectsOperationsThatHaveAttribute() { var dispatcher = new DynamicDispatcher(new MainTarget()); Assert.IsFalse(dispatcher.HasMethod("HiddenOp")); Assert.IsTrue(dispatcher.HasMethod("PublicOp")); }
public void ExposesExtensionMethods() { var dispatcher = new DynamicDispatcher(new MainTarget(), new MyExtension()); Assert.IsTrue(dispatcher.HasMethod("PublicOp")); Assert.IsTrue(dispatcher.HasMethod("ExtMethod")); Assert.AreEqual("Hello", dispatcher.Dispatch("ExtMethod", null)); }
public void CanResolveMethodArgumentsWithParamArray() { var dispatcher = new DynamicDispatcher(new MainTarget()); Assert.AreEqual(20, dispatcher.Dispatch("SumMany", new object[] { 1, 3, 7, 9 })); }
public void CanResolveMethodArguments() { var dispatcher = new DynamicDispatcher(new MainTarget()); Assert.AreEqual(4, dispatcher.Dispatch("Sum", new object[] { 1, 3 })); }
public void CannotInvokeMethodsNotMarkedAsOperation() { var dispatcher = new DynamicDispatcher(new MainTarget()); dispatcher.Dispatch("HiddenOp", null); }
public void CanInvokeDynamicOperations() { var dispatcher = new DynamicDispatcher(new MainTarget()); Assert.AreEqual("good code!", dispatcher.Dispatch("PublicOp", null)); }