public HookBinding(IBindingMethod bindingMethod, HookType hookType, BindingScope bindingScope, int hookOrder) : base(bindingMethod) { HookOrder = hookOrder; HookType = hookType; BindingScope = bindingScope; }
public IStepDefinitionBinding CreateStepBinding(StepDefinitionType type, string regexString, IBindingMethod bindingMethod, BindingScope bindingScope) { if (regexString == null) regexString = stepDefinitionRegexCalculator.CalculateRegexFromMethod(type, bindingMethod); return new StepDefinitionBinding(type, regexString, bindingMethod, bindingScope); }
public StepDefinitionBinding(StepDefinitionType stepDefinitionType, Regex regex, IBindingMethod bindingMethod, BindingScope bindingScope) : base(bindingMethod) { StepDefinitionType = stepDefinitionType; Regex = regex; BindingScope = bindingScope; }
public StepBinding(IBindingMethod method, BindingType bindingType, Regex regex, BindingScope bindingScope) { Method = method; BindingType = bindingType; Regex = regex; BindingScope = bindingScope; }
private IEnumerable<StepBinding> GetSuggestionsFromCodeFunctionForScope(CodeFunction codeFunction, BindingScope bindingScope) { return codeFunction.Attributes.Cast<CodeAttribute2>() .Select(codeAttribute => GetBingingFromAttribute(codeAttribute, codeFunction, BindingType.Given, bindingScope) ?? GetBingingFromAttribute(codeAttribute, codeFunction, BindingType.When, bindingScope) ?? GetBingingFromAttribute(codeAttribute, codeFunction, BindingType.Then, bindingScope)) .Where(binding => binding != null); }
public override int GetHashCode() { unchecked { var hashCode = (int)HookType; hashCode = (hashCode * 397) ^ HookOrder; hashCode = (hashCode * 397) ^ (BindingScope != null ? BindingScope.GetHashCode() : 0); return(hashCode); } }
private void AddStepBinding(MethodInfo method, StepDefinitionBaseAttribute stepDefinitionBaseAttr, BindingScope stepScope) { foreach (var bindingType in stepDefinitionBaseAttr.Types) { var stepBinding = bindingFactory.CreateStepBinding(bindingType, stepDefinitionBaseAttr.Regex, method, stepScope); stepBindings.Add(stepBinding); } }
public EventBinding CreateEventBinding(MethodInfo methodInfo, BindingScope bindingScope) { return new EventBinding(runtimeConfiguration, errorProvider, methodInfo, bindingScope); }
public HookBinding(IBindingMethod bindingMethod, HookType hookType, BindingScope bindingScope) : base(bindingMethod) { HookType = hookType; BindingScope = bindingScope; }
private StepDefinitionBinding CreateStepBinding(CodeAttribute2 attr, CodeFunction codeFunction, StepDefinitionType stepDefinitionType, BindingScope bindingScope) { try { IBindingMethod bindingMethod = bindingReflectionFactory.CreateBindingMethod(codeFunction); var regexArg = attr.Arguments.Cast<CodeAttributeArgument>().FirstOrDefault(); if (regexArg == null) return null; var regexString = VsxHelper.ParseCodeStringValue(regexArg.Value, regexArg.Language); return new StepDefinitionBinding(stepDefinitionType, regexString, bindingMethod, bindingScope); } catch(Exception) { return null; } }
public StepDefinitionBinding(RuntimeConfiguration runtimeConfiguration, IErrorProvider errorProvider, BindingType type, string regexString, MethodInfo methodInfo, BindingScope bindingScope) : base(runtimeConfiguration, errorProvider, methodInfo) { Type = type; Regex regex = new Regex("^" + regexString + "$", RegexOptions); Regex = regex; this.BindingScope = bindingScope; }
private IEnumerable<StepDefinitionBinding> GetStepsFromClass(CodeClass codeClass, BindingScope[] classScopes) { return codeClass.Children.OfType<CodeFunction>().SelectMany(codeFunction => GetSuggestionsFromCodeFunction(codeFunction, classScopes)); }
public EventBinding(RuntimeConfiguration runtimeConfiguration, IErrorProvider errorProvider, MethodInfo methodInfo, BindingScope bindingScope) : base(runtimeConfiguration, errorProvider, methodInfo) { BindingScope = bindingScope; }
public IHookBinding CreateHookBinding(IBindingMethod bindingMethod, HookType hookType, BindingScope bindingScope, int hookOrder) { return(new HookBinding(bindingMethod, hookType, bindingScope, hookOrder)); }
private StepBinding GetBingingFromAttribute(CodeAttribute2 codeAttribute, CodeFunction codeFunction, BindingType bindingType, BindingScope bindingScope) { try { if (codeAttribute.FullName.Equals(string.Format("TechTalk.SpecFlow.{0}Attribute", bindingType))) return CreateStepBinding(codeAttribute, codeFunction, bindingType, bindingScope); return null; } catch(Exception) { return null; } }
private StepBinding CreateStepBinding(CodeAttribute2 attr, CodeFunction codeFunction, BindingType bindingType, BindingScope bindingScope) { try { IBindingMethod bindingMethod = new VsBindingMethod(codeFunction); var regexArg = attr.Arguments.Cast<CodeAttributeArgument>().FirstOrDefault(); if (regexArg == null) return null; var regexString = VsxHelper.ParseCodeStringValue(regexArg.Value, regexArg.Language); var regex = new Regex("^" + regexString + "$", RegexOptions.Compiled | RegexOptions.CultureInvariant); return new StepBinding(bindingMethod, bindingType, regex, bindingScope); } catch(Exception) { return null; } }
protected bool Equals(BindingScope other) { return(string.Equals(Tag, other.Tag) && string.Equals(FeatureTitle, other.FeatureTitle) && string.Equals(ScenarioTitle, other.ScenarioTitle)); }
public HookBinding(RuntimeConfiguration runtimeConfiguration, IErrorProvider errorProvider, MethodInfo methodInfo, BindingScope bindingScope) : base(runtimeConfiguration, errorProvider, methodInfo) { BindingScope = bindingScope; }
public IHookBinding CreateEventBinding(IBindingMethod bindingMethod, BindingScope bindingScope) { return new HookBinding(bindingMethod, bindingScope); }
private void AddStepBinding(IBindingMethod bindingMethod, StepDefinitionBaseAttribute stepDefinitionBaseAttr, BindingScope stepScope) { foreach (var bindingType in stepDefinitionBaseAttr.Types) { var stepBinding = bindingFactory.CreateStepBinding(bindingType, stepDefinitionBaseAttr.Regex, bindingMethod, stepScope); stepDefinitions.Add(stepBinding); } }
private IEnumerable<StepDefinitionBinding> GetSuggestionsFromCodeFunctionForScope(CodeFunction codeFunction, BindingScope bindingScope) { return codeFunction.Attributes.Cast<CodeAttribute2>() .SelectMany(codeAttribute => GetStepDefinitionsFromAttribute(codeAttribute, codeFunction, bindingScope)) .Where(binding => binding != null); }
public HookBinding(IBindingMethod bindingMethod, BindingScope bindingScope) : base(bindingMethod) { BindingScope = bindingScope; }
public IStepDefinitionBinding CreateStepBinding(StepDefinitionType type, string regexString, IBindingMethod bindingMethod, BindingScope bindingScope) { if (regexString == null) { regexString = stepDefinitionRegexCalculator.CalculateRegexFromMethod(type, bindingMethod); } return(new StepDefinitionBinding(type, regexString, bindingMethod, bindingScope)); }
public IHookBinding CreateEventBinding(MethodInfo methodInfo, BindingScope bindingScope) { return(new HookBinding(runtimeConfiguration, errorProvider, methodInfo, bindingScope)); }
public IHookBinding CreateHookBinding(IBindingMethod bindingMethod, HookType hookType, BindingScope bindingScope) { return new HookBinding(bindingMethod, hookType, bindingScope); }
private IEnumerable<StepDefinitionBinding> GetStepDefinitionsFromAttribute(CodeAttribute2 codeAttribute, CodeFunction codeFunction, BindingScope bindingScope) { var normalStepDefinition = GetBingingFromAttribute(codeAttribute, codeFunction, StepDefinitionType.Given, bindingScope) ?? GetBingingFromAttribute(codeAttribute, codeFunction, StepDefinitionType.When, bindingScope) ?? GetBingingFromAttribute(codeAttribute, codeFunction, StepDefinitionType.Then, bindingScope); if (normalStepDefinition != null) { yield return normalStepDefinition; yield break; } if (IsGeneralStepDefinition(codeAttribute)) { yield return CreateStepBinding(codeAttribute, codeFunction, StepDefinitionType.Given, bindingScope); yield return CreateStepBinding(codeAttribute, codeFunction, StepDefinitionType.When, bindingScope); yield return CreateStepBinding(codeAttribute, codeFunction, StepDefinitionType.Then, bindingScope); } }
public StepDefinitionBinding(StepDefinitionType stepDefinitionType, string regexString, IBindingMethod bindingMethod, BindingScope bindingScope) : this(stepDefinitionType, RegexFactory.Create(regexString), bindingMethod, bindingScope) { }
private void AddStepBinding(MethodInfo method, ScenarioStepAttribute scenarioStepAttr, BindingScope stepScope) { StepBinding stepBinding = new StepBinding(scenarioStepAttr.Type, scenarioStepAttr.Regex, method, stepScope); stepBindings.Add(stepBinding); }
protected bool Equals(BindingScope other) { return string.Equals(Tag, other.Tag) && string.Equals(FeatureTitle, other.FeatureTitle) && string.Equals(ScenarioTitle, other.ScenarioTitle); }
protected override void ProcessHooks(BindingSourceMethod bindingSourceMethod, BindingScope[] methodScopes) { //nop - not needed for IDE integration }
protected override void ProcessStepArgumentTransformations(BindingSourceMethod bindingSourceMethod, BindingScope[] methodScopes) { //nop - not needed for IDE integration }
public StepBinding CreateStepBinding(BindingType type, string regexString, MethodInfo methodInfo, BindingScope bindingScope) { return new StepBinding(runtimeConfiguration, errorProvider, type, regexString, methodInfo, bindingScope); }
public StepDefinitionBinding CreateStepBinding(BindingType type, string regexString, MethodInfo methodInfo, BindingScope bindingScope) { return(new StepDefinitionBinding(runtimeConfiguration, errorProvider, type, regexString, methodInfo, bindingScope)); }
public StepBinding(BindingType type, string regexString, MethodInfo methodInfo, BindingScope bindingScope) : base(methodInfo) { Type = type; Regex regex = new Regex("^" + regexString + "$", RegexOptions); Regex = regex; this.BindingScope = bindingScope; }