Beispiel #1
0
        public async Task ExecuteScenario_Executes_ScenarioStep_With_DocString()
        {
            //arrange.
            var featureInstance = new FeatureWithDocStringScenarioStep();
            var output          = new Mock <ITestOutputHelper>();

            featureInstance.InternalOutput = output.Object;
            var docStringContent = "some content" + Environment.NewLine +
                                   "+++" + Environment.NewLine +
                                   "with multi lines" + Environment.NewLine +
                                   "---" + Environment.NewLine +
                                   "in it";
            var scenarioName = "scenario 1231121";

            _featureFileRepository.Setup(r => r.GetByFilePath(nameof(FeatureWithDocStringScenarioStep) + ".feature"))
            .Returns(new FeatureFile(CreateGherkinDocument(scenarioName,
                                                           new string[] { "Given " + FeatureWithDocStringScenarioStep.StepWithDocStringText },
                                                           new Gherkin.Ast.DocString(null, null, docStringContent))))
            .Verifiable();

            //act.
            await _sut.ExecuteScenarioAsync(featureInstance, scenarioName);

            //assert.
            _featureFileRepository.Verify();

            Assert.NotNull(featureInstance.ReceivedDocString);
            Assert.Equal(docStringContent, featureInstance.ReceivedDocString.Content);
        }
        public void DigestScenarioStepValues_Sets_DocString_Value()
        {
            //arrange.
            var featureInstance = new FeatureWithDocStringScenarioStep();
            var sut             = StepMethodInfo.FromMethodInfo(
                featureInstance.GetType().GetMethod(nameof(FeatureWithDocStringScenarioStep.Step_With_DocString_Argument)),
                featureInstance
                );

            var docStringContent = @"some content
+++
with multi lines
---
in it";

            var step = new Gherkin.Ast.Step(
                null,
                "Given",
                FeatureWithDocStringScenarioStep.StepWithDocStringText,
                new Gherkin.Ast.DocString(null, null, docStringContent));

            //act.
            sut.DigestScenarioStepValues(step);

            //assert.
            var digestedText = sut.GetDigestedStepText();

            Assert.Equal(FeatureWithDocStringScenarioStep.StepWithDocStringText, digestedText);
        }
Beispiel #3
0
        public void DigestScenarioStepValues_Sets_DocString_Value()
        {
            //arrange.
            var featureInstance = new FeatureWithDocStringScenarioStep();
            var sut             = StepMethodInfo.FromMethodInfo(
                featureInstance.GetType().GetMethod(nameof(FeatureWithDocStringScenarioStep.Step_With_DocString_Argument)),
                featureInstance
                );

            var scenarioName     = "scenario ajshas a";
            var docStringContent = @"some content
+++
with multi lines
---
in it";

            var step = CreateGherkinDocument(scenarioName,
                                             "Given " + FeatureWithDocStringScenarioStep.StepWithDocStringText + @"
" + @"""""""
" + docStringContent + @"
""""""").Feature.Children.First().Steps.First();

            //act.
            sut.DigestScenarioStepValues(step);

            //assert.
            var digestedText = sut.GetDigestedStepText();

            Assert.Equal(FeatureWithDocStringScenarioStep.StepWithDocStringText, digestedText);
        }
        public void FromMethodInfo_Creates_StepMethodInfo_With_DocString()
        {
            //arrange.
            var featureInstance = new FeatureWithDocStringScenarioStep();

            //act.
            var sut = StepMethodInfo.FromMethodInfo(
                featureInstance.GetType().GetMethod(nameof(FeatureWithDocStringScenarioStep.Step_With_DocString_Argument)),
                featureInstance
                );

            //assert.
            Assert.NotNull(sut);
        }
Beispiel #5
0
        public void ExtractScenario_Extracts_Scenario_With_DocString()
        {
            //arrange.
            var featureInstance  = new FeatureWithDocStringScenarioStep();
            var sut              = FeatureClass.FromFeatureInstance(featureInstance);
            var scenarioName     = "scenario-121kh2";
            var docStringContent = @"some content
    +++
    with multi lines
    ---
    in it";
            var gherkinScenario  = CreateGherkinDocument(scenarioName,
                                                         new string[] { "Given " + FeatureWithDocStringScenarioStep.StepWithDocStringText },
                                                         new Gherkin.Ast.DocString(null, null, docStringContent))
                                   .Feature.Children.First() as Gherkin.Ast.Scenario;

            //act.
            var scenario = sut.ExtractScenario(gherkinScenario);

            //assert.
            Assert.NotNull(scenario);
        }
        public void ExtractScenario_Extracts_Scenario_With_DocString()
        {
            //arrange.
            var featureInstance  = new FeatureWithDocStringScenarioStep();
            var sut              = FeatureClass.FromFeatureInstance(featureInstance);
            var scenarioName     = "scenario-121kh2";
            var docStringContent = @"some content
+++
with multi lines
---
in it";
            var featureFile      = new FeatureFile(CreateGherkinDocument(scenarioName,
                                                                         "Given " + FeatureWithDocStringScenarioStep.StepWithDocStringText + @"
" + @"""""""
" + docStringContent + @"
"""""""));

            //act.
            var scenario = sut.ExtractScenario(scenarioName, featureFile);

            //assert.
            Assert.NotNull(scenario);
        }