예제 #1
0
        public virtual void Print(PrintStream @out)
        {
            T           target          = _targetFactory.newInstance();
            LinePrinter baseLinePrinter = new PrintStreamLinePrinter(@out, 0);

            baseLinePrinter.Println("@Test");
            baseLinePrinter.Println("public void " + _testName + "() throws Exception");
            baseLinePrinter.Println("{");

            LinePrinter codePrinter = baseLinePrinter.Indent();

            codePrinter.Println("// GIVEN");
            _given.print(codePrinter);
            foreach (Action <T, F> action in _actions)
            {
                action.PrintAsCode(target, codePrinter, false);
                action.Apply(target);
            }

            codePrinter.Println("");
            codePrinter.Println("// WHEN/THEN");
            _failingAction.printAsCode(target, codePrinter, true);
            baseLinePrinter.Println("}");
            @out.flush();
        }