예제 #1
0
        public void MapToStep_StepWithTableArgument_ReturnStepWithTable()
        {
            var mapper = this.factory.CreateMapper();

            G.Step step = this.factory.CreateStep(
                "When",
                "I use this table",
                new[]
            {
                new[] { "Header 1", "Header 2" },
                new[] { "Value 1", "Value 2" },
            });

            var result = mapper.MapToStep(step);

            Check.That(result.Keyword).IsEqualTo(Keyword.When);
            Check.That(result.NativeKeyword).IsEqualTo("When");
            Check.That(result.Name).IsEqualTo("I use this table");
            Check.That(result.TableArgument.HeaderRow.Cells).ContainsExactly("Header 1", "Header 2");
            Check.That(result.TableArgument.DataRows).HasSize(1);
            Check.That(result.TableArgument.DataRows[0].Cells).ContainsExactly("Value 1", "Value 2");
            Check.That(result.DocStringArgument).IsNull();
            Check.That(result.Location).IsNull();
            Check.That(result.Comments).IsEmpty();
        }
예제 #2
0
 protected ScenarioDefinition(Location location, string keyword, string name, string description, Step[] steps)
 {
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     Steps = steps;
 }
예제 #3
0
 public Background(Location location, string keyword, string name, string description, Step[] steps)
 {
     Location = location;
     Keyword = keyword;
     Name = name;
     Description = description;
     Steps = steps;
 }
예제 #4
0
        private void FormatStep(Step step, StringBuilder result)
        {
            result.Append(INDENT);
            FormatHasLocation(step, result);
            result.Append(step.Keyword);
            result.Append(step.Text);
            result.AppendLine();

            if (step.Argument is DocString)
                FormatDocString((DocString)step.Argument, result);
            else if (step.Argument is DataTable)
                FormatDataTable((DataTable)step.Argument, result);
        }
예제 #5
0
        public void MapToStep_StepWithWhen_ReturnStep()
        {
            var mapper = this.factory.CreateMapper();

            G.Step step = this.factory.CreateStep("When", "I press 'enter'");

            var result = mapper.MapToStep(step);

            Check.That(result.Keyword).IsEqualTo(Keyword.When);
            Check.That(result.NativeKeyword).IsEqualTo("When");
            Check.That(result.Name).IsEqualTo("I press 'enter'");
            Check.That(result.DocStringArgument).IsNull();
            Check.That(result.TableArgument).IsNull();
        }
예제 #6
0
        public void MapToStep_StepWithDocStringArgument_ReturnStepWithDocString()
        {
            var mapper = this.factory.CreateMapper();

            G.Step step = this.factory.CreateStep("Then", "I see this value on the screen", "120");

            var result = mapper.MapToStep(step);

            Check.That(result.Keyword).IsEqualTo(Keyword.Then);
            Check.That(result.NativeKeyword).IsEqualTo("Then");
            Check.That(result.Name).IsEqualTo("I see this value on the screen");
            Check.That(result.DocStringArgument).IsEqualTo("120");
            Check.That(result.TableArgument).IsNull();
        }
예제 #7
0
        public void MapToStep_StepWithoutArgument_ReturnStep()
        {
            var mapper = this.factory.CreateMapper();

            G.Step step = this.factory.CreateStep("Given", "I enter '50' in the calculator");

            var result = mapper.MapToStep(step);

            Check.That(result.Keyword).IsEqualTo(Keyword.Given);
            Check.That(result.NativeKeyword).IsEqualTo("Given");
            Check.That(result.Name).IsEqualTo("I enter '50' in the calculator");
            Check.That(result.DocStringArgument).IsNull();
            Check.That(result.TableArgument).IsNull();
        }
예제 #8
0
파일: App.cs 프로젝트: shturm/cucunet
		public MethodInfo GetStepMethod (Step step, IEnumerable<MethodInfo> availableMethods)
		{
			MethodInfo result = null;
			foreach (var method in availableMethods) {
				var attrs = method.GetCustomAttributes <BaseStepAttribute> ();
				foreach (var a in attrs) {
					if (String.Compare(a.StepText, step.Text, true) == 0) {
						result = method;
					}
				}

			}

			return result;
		}
예제 #9
0
        public Step MapToStep(G.Step step)
        {
            if (step == null)
            {
                return(null);
            }

            return(new Step
            {
                Location = this.MapToLocation(step.Location),
                DocStringArgument = step.Argument is G.DocString ? this.MapToString((G.DocString)step.Argument) : null,
                Keyword = this.MapToKeyword(step.Keyword),
                NativeKeyword = step.Keyword,
                Name = step.Text,
                TableArgument = step.Argument is G.DataTable ? this.MapToTable((G.DataTable)step.Argument) : null,
            });
        }
예제 #10
0
        public void MapToStep_StepWithLocation_ReturnStepWithLocation()
        {
            var mapper = this.factory.CreateMapper();

            G.Step step = this.factory.CreateStep(
                "Given", "I am on a step", 3, 4
                );

            var result = mapper.MapToStep(step);

            Check.That(result.Keyword).IsEqualTo(Keyword.Given);
            Check.That(result.NativeKeyword).IsEqualTo("Given");
            Check.That(result.Name).IsEqualTo("I am on a step");
            Check.That(result.DocStringArgument).IsNull();
            Check.That(result.TableArgument).IsNull();
            Check.That(result.Location).IsNotNull();
            Check.That(result.Location.Line).IsEqualTo(3);
            Check.That(result.Location.Column).IsEqualTo(4);
            Check.That(result.Comments).IsEmpty();
        }
예제 #11
0
        public Step MapToStep(G.Step step)
        {
            if (step == null)
            {
                return(null);
            }

            var stepResult = new Step
            {
                Location          = this.MapToLocation(step.Location),
                DocStringArgument = step.Argument is G.DocString ? this.MapToString((G.DocString)step.Argument) : null,
                Keyword           = this.MapToKeyword(step.Keyword),
                NativeKeyword     = step.Keyword,
                Name          = step.Text,
                TableArgument = step.Argument is G.DataTable ? this.MapToTable((G.DataTable)step.Argument) : null
            };
            var comments = this.resourceFileMapper.MapFiles(step.Text, stepResult.Location);

            stepResult.Comments.AddRange(comments);

            return(stepResult);
        }
예제 #12
0
 public Background(Location location, string keyword, string name, string description, Step[] steps)
     : base(location, keyword, name, description, steps)
 {
 }
예제 #13
0
 public Step MapToStep(G.Step step)
 {
     return(this.mapper.Map <Step>(step));
 }
예제 #14
0
        internal G.Step CreateStep(string keyword, string text, int locationLine, int locationColumn)
        {
            var step = new G.Step(this.CreateLocation(locationLine, locationColumn), keyword, text, null);

            return(step);
        }
예제 #15
0
 internal G.Step CreateStep(string keyword, string text, int locationLine, int locationColumn)
 {
     var step =  new G.Step(this.CreateLocation(locationLine, locationColumn), keyword, text, null);
     return step;
 }
예제 #16
0
 public ScenarioOutline(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps, Examples[] examples)
     : base(location, keyword, name, description, steps)
 {
     Tags = tags;
     Examples = examples;
 }
예제 #17
0
파일: Scenario.cs 프로젝트: Zearin/gherkin
 public Scenario(Tag[] tags, Location location, string keyword, string name, string description, Step[] steps)
     : base(location, keyword, name, description, steps)
 {
     Tags = tags;
 }
예제 #18
0
		public void Log (Step step)
		{
			Console.WriteLine ("    {0}{1}", step.Keyword, step.Text);
		}
예제 #19
0
		Step CreateStep (string keyword, string text)
		{
			var location = new Location (0, 0);
			var arg = new StepArgumentMock ();

			var step = new Step (location, keyword, text, arg);

			return step;
		}