public object Do(CherryCommandArgs args) { try { return this.responseFunction(args); } catch (Exception ex) { Trace.WriteLine(string.Format("Exception on command '{0}' invoke {1}\n{2}", this.Name, ex.Message, ex.StackTrace)); return null; } }
public object Do(CherryCommandArgs args) { try { return(this.responseFunction(args)); } catch (Exception ex) { Trace.WriteLine(string.Format("Exception on command '{0}' invoke {1}\n{2}", this.Name, ex.Message, ex.StackTrace)); return(null); } }
public void CherryCommandListenersCollectionSimpleTest() { var collection = new CherryCommandsCollection(); var listenersProvider = new TestCherryCommandListenersProvider(); collection.AddProvider(listenersProvider); var ra = new CherryCommandArgs(); Assert.AreEqual(ra, collection[listenerName].Do(ra)); Assert.Throws<PluginException>(() => collection["non existent listener"].Do(null)); // Do not add same listener name twice. Assert.Throws<PluginException>(() => collection.AddProvider(new TestCherryCommandListenersProvider())); }
public void CreateCherryCommandListenerTest() { CherryCommandArgs sentArgs = new CherryCommandArgs(); const string listenerName = "listener Name"; var rl = new CherryCommand( listenerName, ra => { Assert.AreEqual(sentArgs, ra); return 1; }); Assert.AreEqual(listenerName, rl.Name); Assert.AreEqual(1, rl.Do(sentArgs)); }
public void CreateCherryCommandListenerTest() { CherryCommandArgs sentArgs = new CherryCommandArgs(); const string listenerName = "listener Name"; var rl = new CherryCommand( listenerName, ra => { Assert.AreEqual(sentArgs, ra); return(1); }); Assert.AreEqual(listenerName, rl.Name); Assert.AreEqual(1, rl.Do(sentArgs)); }
public void CherryCommandListenersCollectionSimpleTest() { var collection = new CherryCommandsCollection(); var listenersProvider = new TestCherryCommandListenersProvider(); collection.AddProvider(listenersProvider); var ra = new CherryCommandArgs(); Assert.AreEqual(ra, collection[listenerName].Do(ra)); Assert.Throws <PluginException>(() => collection["non existent listener"].Do(null)); // Do not add same listener name twice. Assert.Throws <PluginException>(() => collection.AddProvider(new TestCherryCommandListenersProvider())); }
public object InvokeCommand(string listenerName, CherryCommandArgs args) { return(this.cherryService.PluginRepository.CherryCommands[listenerName].Do(args)); }
public void CreateArgsTest() { var ra = new CherryCommandArgs(); }
public void CreateArgsTest() { var ra = new CherryCommandArgs(); }
public object InvokeCommand(string listenerName, CherryCommandArgs args) { return this.cherryService.PluginRepository.CherryCommands[listenerName].Do(args); }