예제 #1
0
 public void Write(CompilationUnit compilationUnit, TextWriter writer)
 {
     using (var writingVisitor = new WriterVisitor(writer, false))
     {
         writingVisitor.Visit(compilationUnit);
     }
 }
예제 #2
0
 public void Write(CompilationUnit compilationUnit, string path)
 {
     using (var writingVisitor = new WriterVisitor(FileUtils.CreateText(path)))
     {
         writingVisitor.Visit(compilationUnit);
     }
 }
예제 #3
0
        public void write_a_test()
        {
            Test test = DataMother.MathProject().LoadTests().GetAllTests().First();
            var  node = new JsonNode("Test");

            var visitor = new WriterVisitor(test, node);

            visitor.Write();

            Debug.WriteLine(node.ToJson());
        }
예제 #4
0
        public void Visitor_WhenNotReturningState_ThreadsPreviousStateThrough()
        {
            var subject = new TestSubject(1,
                                          new TestSubject(2),
                                          new TestSubject(3,
                                                          new TestSubject(4),
                                                          new TestSubject(5)));

            var writer  = new StringWriter();
            var visitor = new WriterVisitor();

            visitor.Dispatch(subject, writer);

            Assert.AreEqual("12345", writer.GetStringBuilder().ToString());
        }
예제 #5
0
        public void write_a_second_test()
        {
            var  section = new Section("AutoDispatchConfiguration");
            Test test    = new Test("AutoDispatchRules").With(section);

            Step     step1 = section.AddStep("IfPriorityEquals").With("priority", "High");
            StepLeaf leaf1 = step1.LeafFor("AndOr");

            leaf1.Add(new Step("AndStatusEquals").With("status", "Open"));
            leaf1.Add(new Step("AndTitleEquals").With("title", "This one"));

            StepLeaf leaf2 = step1.LeafFor("AutoDispatchAction");

            leaf2.Add(new Step("AssignToUser").With("user", "annieAgent"));

            var node = new JsonNode("Test");

            var visitor = new WriterVisitor(test, node);

            visitor.Write();

            Debug.WriteLine(node.ToJson());
        }
예제 #6
0
 public AttributeWriter(BinaryWriter writer)
 {
     _writer = new WriterVisitor(writer);
 }