public void AddArgumentValue_AddsArgument() { MethodInvocationContext context = new MethodInvocationContext(); context.AddArgumentValue(5); DatasourceFactory factory = context.GetArguments().First(); Assert.NotNull(factory); }
public void AddArgumentSource_AddsArgument() { MethodInvocationContext context = new MethodInvocationContext(); context.AddArgumentSource(typeof(RandomStringSource)); DatasourceFactory factory = context.GetArguments().First(); Assert.NotNull(factory); }
public void RegisterMethod(MethodInfo method, MethodInvocationContext context) { EngineTypeMember member = ReflectionHelper.GetMember(method); if (mType.GetRegisteredMember(member) == null) { mType.RegisterMember(member); } IEngineConfigurationTypeMember registeredMember = mType.GetRegisteredMember(member); registeredMember.SetDatasources(context.GetArguments().Cast<IEngineConfigurationDatasource>()); }
public void RegisterMethod(MethodInfo method, MethodInvocationContext context) { var member = ReflectionHelper.GetMember(method); if (mType.GetRegisteredMember(member) == null) { mType.RegisterMember(member); } var registeredMember = mType.GetRegisteredMember(member); registeredMember.SetDatasources(context.GetArguments().Cast <IEngineConfigurationDatasource>()); }
public IEngineConfigurationTypeBuilder SetupMethod(string methodName, MethodInvocationContext context) { DatasourceFactory[] factories = context.GetArguments().ToArray(); MethodInfo info = mType.GetMethods(BindingFlags.Public | BindingFlags.Instance).Where(x => x.Name == methodName && x.GetParameters().Length == factories.Length) .FirstOrDefault(); if (info == null) { throw new ArgumentException("Method does not exist", methodName); } var memberBuilder = new EngineConfigurationTypeMemberBuilder(ReflectionHelper.GetMember(info), this); mMembers.Add(memberBuilder); memberBuilder.SetDatasources(factories); return(this); }
public IEngineConfigurationTypeBuilder SetupMethod(string methodName, MethodInvocationContext context) { DatasourceFactory[] factories = context.GetArguments().ToArray(); MethodInfo info = mType.GetMethods(BindingFlags.Public | BindingFlags.Instance).Where(x => x.Name == methodName && x.GetParameters().Length == factories.Length) .FirstOrDefault(); if (info == null) { throw new ArgumentException("Method does not exist", methodName); } var memberBuilder = new EngineConfigurationTypeMemberBuilder(ReflectionHelper.GetMember(info), this); mMembers.Add(memberBuilder); memberBuilder.SetDatasources(factories); return this; }