예제 #1
0
 /// <summary>
 /// Enumerates over this and each of its ancestors. Reverse the collection to go through the story in correct order
 /// </summary>
 /// <returns>IEnumerable&lt;IStepContainer&gt;.</returns>
 IEnumerable <IStepContainer> IStepContainer.SelfAndAncestors()
 {
     for (IStepContainer f = this; f != null; f = f.Parent)
     {
         yield return(f);
     }
 }
예제 #2
0
        private string Code(IStepContainer b)
        {
            CodeWriter writer = new CodeWriter();

            this.Settings.GetCodeGenerator().Generate(b.SelfAndAncestors().Reverse().ToList(), writer);
            return(writer.ToString());
        }
예제 #3
0
        public void Generate(IEnumerable <IStepContainer> fragments, CodeWriter writer)
        {
            IStepContainer first = fragments.First();
            string         s     = Regex.Replace(" " + first.Step.Text, " \\w|_", match => match.Value.Trim().ToUpperInvariant());

            writer.WriteLine("[" + this.testFrameworkData.TestMethodAttribute + "]");
            writer.WriteLine("public void " + s + "()");
            using (writer.CodeBlock())
            {
                this.child.Generate(fragments, writer);
            }
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FragmentBase" /> class.
 /// </summary>
 /// <param name="step">The step.</param>
 /// <param name="parent">The parent.</param>
 public FragmentBase(Step step, IStepContainer parent)
 {
     this.step   = step;
     this.parent = parent;
 }