Пример #1
0
 /// <summary>
 /// Provides <see cref="INameInfo"/> object containing information about scenario name represented by <paramref name="scenarioDescriptor"/>.
 /// </summary>
 /// <param name="scenarioDescriptor">Scenario descriptor.</param>
 /// <returns><see cref="INameInfo"/> object.</returns>
 public INameInfo GetScenarioName(ScenarioDescriptor scenarioDescriptor)
 {
     try
     {
         var formattedStepName = _nameParser.GetNameFormat(scenarioDescriptor.MethodInfo, scenarioDescriptor.MethodInfo.Name, scenarioDescriptor.Parameters);
         var arguments         = scenarioDescriptor.Parameters.Select(p => new MethodArgument(p, GetValueFormattingServiceFor(p.ParameterInfo))).ToArray();
         return(new NameInfo(
                    formattedStepName,
                    arguments.Select(p => p.FormatNameParameter()).ToArray()));
     }
     catch (Exception e)
     {
         throw new InvalidOperationException($"Unable to obtain scenario name for method {scenarioDescriptor.MethodInfo.Name}: {e.Message}", e);
     }
 }
Пример #2
0
 /// <summary>
 /// Returns a collection of <see cref="IScenarioDecorator"/> decorators that are applied on scenario described by <paramref name="scenarioDescriptor"/> parameter.
 /// The <see cref="IScenarioDecorator"/> are inferred from declaring type and method attributes that implements <see cref="IScenarioDecoratorAttribute"/> type.
 /// The returned collection would be sorted ascending based on <see cref="IOrderedAttribute.Order"/> from declaring type and then based on <see cref="IOrderedAttribute.Order"/> from method.
 /// </summary>
 /// <param name="scenarioDescriptor">Scenario descriptor.</param>
 /// <returns>Collection of decorators or empty collection if none are present.</returns>
 public IEnumerable <IScenarioDecorator> GetScenarioDecorators(ScenarioDescriptor scenarioDescriptor)
 {
     return(ConcatAndOrderAttributes(
                ExtractAttributes <IScenarioDecoratorAttribute>(scenarioDescriptor.MethodInfo.DeclaringType),
                ExtractAttributes <IScenarioDecoratorAttribute>(scenarioDescriptor.MethodInfo)));
 }
Пример #3
0
 /// <summary>
 /// Returns a collection of <see cref="IScenarioDecorator"/> decorators that are applied on scenario described by <paramref name="scenarioDescriptor"/> parameter.
 /// The <see cref="IScenarioDecorator"/> are inferred from method attributes that implements <see cref="IScenarioDecoratorAttribute"/> type.
 /// The returned collection would be sorted ascending based on <see cref="IOrderedAttribute.Order"/> property.
 /// </summary>
 /// <param name="scenarioDescriptor">Scenario descriptor.</param>
 /// <returns>Collection of decorators or empty collection if none are present.</returns>
 public IEnumerable <IScenarioDecorator> GetScenarioDecorators(ScenarioDescriptor scenarioDescriptor)
 {
     return(ExtractAttributes <IScenarioDecoratorAttribute>(scenarioDescriptor.MethodInfo)
            .OrderBy(x => x.Order));
 }