public void Then_feature_without_background_adds_first_scenario_on_correct_row()
        {
            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 scenario = new Scenario
            {
                Name        = "Test Scenario",
                Description =
                    "In order to test this scenario,\nAs a developer\nI want to test this scenario"
            };
            var given = new Step {
                NativeKeyword = "Given", Name = "a precondition"
            };

            scenario.Steps = new List <Step>(new[] { given });
            feature.AddFeatureElement(scenario);

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

                Check.That(worksheet.Cell("B4").Value).IsEqualTo(scenario.Name);
                Check.That(worksheet.Cell("C5").Value).IsEqualTo(scenario.Description);
                Check.That(worksheet.Cell("D6").Value).IsEqualTo(given.Name);
            }
        }
示例#2
0
        public void When_ScenarioOutline_Is_Available_It_Is_Included_After_Heading()
        {
            var mockStyle = new MockStylist
            {
                FeatureHeadingFormat         = "FeatureHeading: {0}",
                ScenarioOutlineHeadingFormat = "ScenarioOutlineHeading: {0}"
            };
            var feature = new Feature
            {
                Name = "Feature with Scenario Outline"
            };

            feature.AddFeatureElement(new ScenarioOutline()
            {
                Name = "My Scenario Outline"
            });

            var featureBlock = new FeatureBlock(feature, mockStyle);
            var actualString = featureBlock.ToString().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            Assert.AreEqual("FeatureHeading: Feature with Scenario Outline", actualString[0]);
            Assert.AreEqual("ScenarioOutlineHeading: My Scenario Outline", actualString[2]);
            Assert.AreEqual(5, actualString.Length);
        }