public void overridingMethodResolves() { IList<MethodInfo> candidates = HandlerMethodUtils.GetCandidateHandlerMethods(new TestSubclass()); PayloadTypeMatchingHandlerMethodResolver resolver = new PayloadTypeMatchingHandlerMethodResolver(candidates); MethodInfo resolved = resolver.ResolveHandlerMethod(new StringMessage("test")); MethodInfo expected = ReflectionUtils.GetMethod(typeof (TestSubclass), "Test", new[] {typeof (string)}); Assert.That(resolved, Is.EqualTo(expected)); }
public void TestStringMessageTypedParameter() { Object service = new TestServiceWithMessageTypes(); IList<MethodInfo> candidates = HandlerMethodUtils.GetCandidateHandlerMethods(service); PayloadTypeMatchingHandlerMethodResolver methodResovler = new PayloadTypeMatchingHandlerMethodResolver(candidates); Type[] types = new[] {typeof (StringMessage)}; MethodInfo expected = typeof (TestServiceWithMessageTypes).GetMethod("StringMessage", types); IMessage message = new StringMessage("foo"); MethodInfo resolved = methodResovler.ResolveHandlerMethod(message); Assert.That(resolved, Is.EqualTo(expected)); Assert.That(resolved.Invoke(service, new object[] {message}), Is.EqualTo("foo")); }