public void DigestScenarioStepValues_Sets_Primitive_Values(string keyword)
        {
            //arrange.
            var featureInstance = new FeatureForApplyArgumentValues();
            var sut             = StepMethodInfo.FromMethodInfo(
                featureInstance.GetType().GetMethod(nameof(FeatureForApplyArgumentValues.Method_With_Arguments)),
                featureInstance);

            var number   = 123;
            var text     = "Ana";
            var date     = new DateTime(2018, 5, 23);
            var stepText = FeatureForApplyArgumentValues.StepMethodText
                           .Replace(@"(\d+)", $"{number}")
                           .Replace(@"(\w+)", $"{text}")
                           .Replace(@"([\d/]+)", $"{date.Month}/{date.Day}/{date.Year}");

            var step = new Gherkin.Ast.Step(null, keyword, stepText, null);

            //act.
            sut.DigestScenarioStepValues(step);

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

            Assert.Equal(stepText, digestedText);
        }
Example #2
0
        public void DigestScenarioStepValues_Sets_Primitive_Values()
        {
            //arrange.
            var featureInstance = new FeatureForApplyArgumentValues();
            var sut             = StepMethodInfo.FromMethodInfo(
                featureInstance.GetType().GetMethod(nameof(FeatureForApplyArgumentValues.Method_With_Arguments)),
                featureInstance);

            var number   = 123;
            var text     = "Ana";
            var date     = new DateTime(2018, 5, 23);
            var stepText = FeatureForApplyArgumentValues.StepMethodText
                           .Replace(@"(\d+)", $"{number}")
                           .Replace(@"(\w+)", $"{text}")
                           .Replace(@"([\d/]+)", $"{date.Month}/{date.Day}/{date.Year}");

            var step = CreateGherkinDocument("some scenario", "Then " + stepText)
                       .Feature.Children.First().Steps.First();

            //act.
            sut.DigestScenarioStepValues(step);

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

            Assert.Equal(stepText, digestedText);
        }