当前位置: 首页>>代码示例>>C#>>正文


C# Feature.AddBackground方法代码示例

本文整理汇总了C#中PicklesDoc.Pickles.ObjectModel.Feature.AddBackground方法的典型用法代码示例。如果您正苦于以下问题:C# Feature.AddBackground方法的具体用法?C# Feature.AddBackground怎么用?C# Feature.AddBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PicklesDoc.Pickles.ObjectModel.Feature的用法示例。


在下文中一共展示了Feature.AddBackground方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Then_feature_with_background_is_added_successfully

        public void Then_feature_with_background_is_added_successfully()
        {
            var excelFeatureFormatter = Container.Resolve<ExcelFeatureFormatter>();

            var feature = new Feature
            {
                Name = "Test Feature",
                Description =
                    "In order to test this feature,\nAs a developer\nI want to test this feature",
            };
            var background = new Scenario
            {
                Name = "Test Background Scenario",
                Description =
                    "In order to test this background,\nAs a developer\nI want to test this background"
            };
            var given = new Step { NativeKeyword = "Given", Name = "a precondition" };
            background.Steps = new List<Step>(new[] { given });
            feature.AddBackground(background);

            using (var workbook = new XLWorkbook())
            {
                IXLWorksheet worksheet = workbook.AddWorksheet("SHEET1");
                excelFeatureFormatter.Format(worksheet, feature);

                Check.That(worksheet.Cell("B4").Value).IsEqualTo(background.Name);
                Check.That(worksheet.Cell("C5").Value).IsEqualTo(background.Description);
                Check.That(worksheet.Cell("D6").Value).IsEqualTo(given.Name);
            }
        }
开发者ID:picklesdoc,项目名称:pickles,代码行数:30,代码来源:WhenAddingAFeatureToAWorksheet.cs

示例2: Map_WithBackground_ReturnsBackground

        public void Map_WithBackground_ReturnsBackground()
        {
            var feature = new Feature();
            feature.AddBackground(
                new Scenario
                {
                    Description = "The description of the background"
                });

            var mapper = CreateMapper();

            var actual = mapper.Map(feature);

            Check.That(actual.Background.Description).IsEqualTo("The description of the background");
            Check.That(actual.Background.Feature).IsSameReferenceThan(actual);
        }
开发者ID:picklesdoc,项目名称:pickles,代码行数:16,代码来源:FeatureToJsonFeatureMapperTests.cs

示例3: 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;
        }
开发者ID:ngm,项目名称:pickles,代码行数:74,代码来源:Mapper.cs


注:本文中的PicklesDoc.Pickles.ObjectModel.Feature.AddBackground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。