public void SetUp()
 {
     var controller = new CSharpController();
     codeRoot = new CodeRoot(controller);
     var ns = new Namespace(controller, "Namespace1") { Index = 0 };
     codeRoot.AddChild(ns);
     ns.AddChild(new Class(controller, "Class1") { Index = 1 });
 }
Esempio n. 2
0
        public void MatchesSavedSuccessfully()
        {
            XmlDocument doc        = new XmlDocument();
            Controller  controller = new CSharpController();

            controller.Reorder = true;

            CodeRootMap map       = new CodeRootMap();
            CodeRoot    userCR    = new CodeRoot(controller);
            CodeRoot    newgenCR  = new CodeRoot(controller);
            CodeRoot    prevgenCR = new CodeRoot(controller);

            Class clazz = new Class(controller, "Class1");

            clazz.AddChild(new Class(controller, "InnerClass"));
            userCR.AddChild(clazz);

            clazz = new Class(controller, "Class2");
            clazz.AddChild(new Class(controller, "InnerClass"));
            newgenCR.AddChild(clazz);

            clazz = new Class(controller, "Class3");
            clazz.AddChild(new Class(controller, "InnerClass"));
            prevgenCR.AddChild(clazz);

            map.AddCodeRoot(userCR, Version.User);
            map.AddCodeRoot(newgenCR, Version.NewGen);
            map.AddCodeRoot(prevgenCR, Version.PrevGen);

            Assert.That(map.MatchConstructs("Class1", "Class2", "Class3"), "Matching constructs", Is.True);

            CodeRootMapMatchProcessor processor = new CodeRootMapMatchProcessor();

            processor.SaveCustomMappings(doc, map, "Test.cs");
            XmlNodeList nodes = doc.SelectNodes("Manifest/Mappings/CodeRootMappings/CodeRootMap");

            Assert.IsNotNull(nodes, "Couldn't find the CodeRootMap nodes");
            Assert.That(nodes.Count, Is.EqualTo(1));

            Assert.That(nodes.Item(0).Attributes["filename"].Value, Is.EqualTo("Test.cs"));

            XmlNode mappingElement = nodes.Item(0);

            XmlNode userNode = mappingElement.SelectSingleNode(ManifestConstants.UserObjectElement);
            XmlNode newgNode = mappingElement.SelectSingleNode(ManifestConstants.NewGenObjectElement);
            XmlNode prevNode = mappingElement.SelectSingleNode(ManifestConstants.PrevGenObjectElement);

            Assert.That(userNode, Is.Not.Null);
            Assert.That(newgNode, Is.Not.Null);
            Assert.That(prevNode, Is.Not.Null);

            Assert.That(userNode.InnerText, Is.EqualTo("Class1"));
            Assert.That(newgNode.InnerText, Is.EqualTo("Class2"));
            Assert.That(prevNode.InnerText, Is.EqualTo("Class3"));
        }
        public void SetUp()
        {
            var controller = new CSharpController();

            codeRoot = new CodeRoot(controller);
            var ns = new Namespace(controller, "Namespace1")
            {
                Index = 0
            };

            codeRoot.AddChild(ns);
            ns.AddChild(new Class(controller, "Class1")
            {
                Index = 1
            });
        }
        protected void SetupFunctions()
        {
            controller = new CSharpController();

            func1 = CreateFunction("Function1", "i", 21);
            func2 = CreateFunction("Function2", "j", 22);
            func3 = CreateFunction("Function3", "k", 23);
            func4 = CreateFunction("Function4", "l", 24);

            Class cl = new Class(controller, "Class1");

            cl.AddChild(func1);
            cl.AddChild(func2);
            cl.AddChild(func3);
            cl.AddChild(func4);

            controller.Root.AddChild(cl);
        }
        public void MatchesSavedSuccessfully()
        {
            XmlDocument doc = new XmlDocument();
            Controller controller = new CSharpController();
            controller.Reorder = true;

            CodeRootMap map = new CodeRootMap();
            CodeRoot userCR = new CodeRoot(controller);
            CodeRoot newgenCR = new CodeRoot(controller);
            CodeRoot prevgenCR = new CodeRoot(controller);

            Class clazz = new Class(controller, "Class1");
            clazz.AddChild(new Class(controller, "InnerClass"));
            userCR.AddChild(clazz);

            clazz = new Class(controller, "Class2");
            clazz.AddChild(new Class(controller, "InnerClass"));
            newgenCR.AddChild(clazz);

            clazz = new Class(controller, "Class3");
            clazz.AddChild(new Class(controller, "InnerClass"));
            prevgenCR.AddChild(clazz);

            map.AddCodeRoot(userCR,		Version.User);
            map.AddCodeRoot(newgenCR,	Version.NewGen);
            map.AddCodeRoot(prevgenCR,	Version.PrevGen);

            Assert.That(map.MatchConstructs("Class1", "Class2", "Class3"), "Matching constructs", Is.True);

            CodeRootMapMatchProcessor processor = new CodeRootMapMatchProcessor();
            processor.SaveCustomMappings(doc, map, "Test.cs");
            XmlNodeList nodes = doc.SelectNodes("Manifest/Mappings/CodeRootMappings/CodeRootMap");
            Assert.IsNotNull(nodes, "Couldn't find the CodeRootMap nodes");
            Assert.That(nodes.Count, Is.EqualTo(1));

            Assert.That(nodes.Item(0).Attributes["filename"].Value, Is.EqualTo("Test.cs"));

            XmlNode mappingElement = nodes.Item(0);

            XmlNode userNode = mappingElement.SelectSingleNode(ManifestConstants.UserObjectElement);
            XmlNode newgNode = mappingElement.SelectSingleNode(ManifestConstants.NewGenObjectElement);
            XmlNode prevNode = mappingElement.SelectSingleNode(ManifestConstants.PrevGenObjectElement);

            Assert.That(userNode, Is.Not.Null);
            Assert.That(newgNode, Is.Not.Null);
            Assert.That(prevNode, Is.Not.Null);

            Assert.That(userNode.InnerText, Is.EqualTo("Class1"));
            Assert.That(newgNode.InnerText, Is.EqualTo("Class2"));
            Assert.That(prevNode.InnerText, Is.EqualTo("Class3"));
        }
 public VBEmptyPlaceholder(CSharpController controller, string name, int index)
     : base(controller, name, index)
 {
 }
        protected void SetupFunctions()
        {
            controller = new CSharpController();

            func1 = CreateFunction("Function1", "i", 21);
            func2 = CreateFunction("Function2", "j", 22);
            func3 = CreateFunction("Function3", "k", 23);
            func4 = CreateFunction("Function4", "l", 24);

            Class cl = new Class(controller, "Class1");
            cl.AddChild(func1);
            cl.AddChild(func2);
            cl.AddChild(func3);
            cl.AddChild(func4);

            controller.Root.AddChild(cl);
        }
Esempio n. 8
0
 public void Setup()
 {
     controller         = new CSharpController();
     controller.Reorder = true;
 }
 public void Setup()
 {
     controller = new CSharpController();
     controller.Reorder = true;
 }
 public void Setup()
 {
     controller = new CSharpController();
 }
Esempio n. 11
0
 public VBEmptyPlaceholder(CSharpController controller, string name, int index) : base(controller, name, index)
 {
 }
Esempio n. 12
0
 public void Setup()
 {
     controller = new CSharpController();
 }
Esempio n. 13
0
 /// <summary>
 /// Removes all state from this object so it can be reused for a different parse.
 /// </summary>
 public void Reset()
 {
     controller = new CSharpController();
     parseWaitHandle.Reset();
     parseFinished = false;
     //currentCode = "";
     objectStack.Clear();
     comments.Clear();
     baseConstructs.Clear();
     syntaxErrors.Clear();
     if (formatter != null)
         formatter.SetFormatSettings(formatSettings);
 }