本文整理汇总了C#中PicklesDoc.Pickles.ObjectModel.Feature.AddTag方法的典型用法代码示例。如果您正苦于以下问题:C# Feature.AddTag方法的具体用法?C# Feature.AddTag怎么用?C# Feature.AddTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PicklesDoc.Pickles.ObjectModel.Feature
的用法示例。
在下文中一共展示了Feature.AddTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapToFeature
public Feature MapToFeature(G.GherkinDocument gherkinDocument)
{
if (gherkinDocument == null)
{
return null;
}
var feature = new Feature();
var background = gherkinDocument.Feature.Children.SingleOrDefault(c => c is G.Background) as G.Background;
if (background != null)
{
feature.AddBackground(this.MapToScenario(background));
}
if (this.configuration.ShouldEnableComments)
{
feature.Comments.AddRange((gherkinDocument.Comments ?? new G.Comment[0]).Select(this.MapToComment));
}
feature.Description = gherkinDocument.Feature.Description ?? string.Empty;
foreach (var featureElement in gherkinDocument.Feature.Children.Where(c => !(c is G.Background)))
{
feature.AddFeatureElement(this.MapToFeatureElement(featureElement));
}
feature.Name = gherkinDocument.Feature.Name;
foreach (var tag in gherkinDocument.Feature.Tags)
{
feature.AddTag(this.MapToString(tag));
}
foreach (var comment in feature.Comments.ToArray())
{
// Find the related feature
var relatedFeatureElement = feature.FeatureElements.LastOrDefault(x => x.Location.Line < comment.Location.Line);
// Find the step to which the comment is related to
if (relatedFeatureElement != null)
{
var stepAfterComment = relatedFeatureElement.Steps.FirstOrDefault(x => x.Location.Line > comment.Location.Line);
if (stepAfterComment != null)
{
// Comment is before a step
comment.Type = CommentType.StepComment;
stepAfterComment.Comments.Add(comment);
}
else
{
// Comment is located after the last step
var stepBeforeComment = relatedFeatureElement.Steps.LastOrDefault(x => x.Location.Line < comment.Location.Line);
if (stepBeforeComment != null && stepBeforeComment == relatedFeatureElement.Steps.Last())
{
comment.Type = CommentType.AfterLastStepComment;
stepBeforeComment.Comments.Add(comment);
}
}
}
}
foreach (var featureElement in feature.FeatureElements.ToArray())
{
featureElement.Feature = feature;
}
if (feature.Background != null)
{
feature.Background.Feature = feature;
}
return feature;
}