public IKayakDelegate Load(string configurationString) { var locator = new DefaultConfigurationLocator(); var typeAndMethodName = locator.Locate( configurationString, a => new[] { a.GetName().Name + ".KayakDelegate" }, null); if (typeAndMethodName == null) return null; var type = typeAndMethodName.Item1; var method = typeAndMethodName.Item2; // we're always looking for a type. if (method != null) return null; if (!typeof(IKayakDelegate).IsAssignableFrom(type)) return null; IKayakDelegate del = null; try { del = (IKayakDelegate)Activator.CreateInstance(type); } catch (Exception e) { return null; } return del; }
public IKayakDelegate Load(string configurationString) { var locator = new DefaultConfigurationLocator(); var typeAndMethodName = locator.Locate( configurationString, a => new[] { a.GetName().Name + ".KayakDelegate" }, null); if (typeAndMethodName == null) { return(null); } var type = typeAndMethodName.Item1; var method = typeAndMethodName.Item2; // we're always looking for a type. if (method != null) { return(null); } if (!typeof(IKayakDelegate).IsAssignableFrom(type)) { return(null); } IKayakDelegate del = null; try { del = (IKayakDelegate)Activator.CreateInstance(type); } catch (Exception e) { return(null); } return(del); }
public void SetUp() { _locator = new DefaultConfigurationLocator(); }