public HandlerMeta[] GetHandlers(Type type) { Record("GetHandlers", type); Assert.AreEqual(typeof(TestReceiver), type); return(new[] { new HandlerMeta(typeof(TestEntity), typeof(int), 1, EfficientInvoker.ForMethod(typeof(TestReceiver), "IntReceive")), new HandlerMeta(typeof(TestEntity), typeof(char), 2, EfficientInvoker.ForMethod(typeof(TestReceiver), "CharReceive")), // Invalid handler, should be ignored new HandlerMeta(typeof(string), typeof(char), 2, null) }); }
public void GlobalStorage() { var handler = new MockHandlerResolver(new[] { new HandlerMeta(null, typeof(int), 2, EfficientInvoker.ForMethod(typeof(TestReceiver), "HandleSignal")) }); var es = new GlobalStorage(handler); RunMeasure(() => { var receiver = new TestReceiver(); es.On().Add(receiver); es.On().Send(1); es.On().Remove(receiver); }); }
public void DynamicEntityStorage() { var handler = new MockHandlerResolver(new[] { new HandlerMeta(typeof(TestEntity), typeof(int), 2, EfficientInvoker.ForMethod(typeof(TestReceiver), "HandleSignal")) }); var es = new DynamicStorage(handler); var entity = new TestEntity(); RunMeasure(() => { var receiver = new TestReceiver(); es.On <TestEntity>().Add(receiver); es.On(entity).Send(1); es.On <TestEntity>().Remove(receiver); }); }
public static EfficientInvoker GetMethodInvoker(this Type type, string methodName) { return(EfficientInvoker.ForMethod(type, methodName)); }