예제 #1
0
 private void WriteContextSetup(Scenario scenario)
 {
     _blockWriter.AppendLine(@"[TestFixtureSetUp]");
     _blockWriter.AppendLine(@"protected void BeforeAll()");
     _blockWriter.WrapWithBraces(() => scenario.Givens
                              .Union(scenario.Whens)
                              .ToList()
                              .ForEach(s => _blockWriter.AppendLine(string.Format("{0}();", s))));
 }
예제 #2
0
        private string Build(Scenario scenario, Context context)
        {
            _blockWriter.AppendLine(@"using System;");
            _blockWriter.AppendLine(@"using NUnit.Framework;");
            _blockWriter.AppendLine();
            _blockWriter.AppendLine(string.Format(@"namespace {0}", context.Namespace));

            _blockWriter.WrapWithBraces(() =>
            {
                _blockWriter.AppendLine(@"[TestFixture]");
                _blockWriter.AppendLine(string.Format(@"public class {0} : {1}", scenario, context));

                _blockWriter.WrapWithBraces(() =>
                                                {
                                                    WriteContextSetup(scenario);
                                                    WriteContextTearDown();
                                                    scenario.Thens.ToList().ForEach(WriteThen);
                                                });
            });

            return _blockWriter.Flush();
        }
예제 #3
0
 public void BuildScenario(Scenario scenario, Context context)
 {
     _applicationHost.WriteFile(string.Format(@"{0}\{1}.cs", context.Namespace, scenario), Build(scenario, context));
 }