コード例 #1
0
        public void TestProgramClassType_1()
        {
            string        name1       = "TestClass";
            string        name2       = "TestClass";
            List <string> list        = new List <string>();
            List <string> modifiers1  = new List <string>();
            List <string> modifiers2  = new List <string>();
            List <string> returnTypes = new List <string>();
            List <string> modifiers   = new List <string>();

            ProgramClass programClass1;
            ProgramClass programClass2;

            modifiers1.Add("class");
            modifiers1.Add("1");
            modifiers1.Add("modifiers");
            modifiers2.Add("class");
            modifiers2.Add("2");
            modifiers2.Add("modifiers");
            returnTypes.Add("int");
            modifiers.Add("public");

            programClass1 = new ProgramClass(name1, modifiers1, list);
            programClass2 = new ProgramClass(name2, modifiers2, list);

            programClass1.ChildList.Add(new ProgramFunction("FunctionName", list, returnTypes, list, list, list));
            programClass2.OwnedClasses.Add(new ProgramClass("ClassName", modifiers, list));

            Assert.AreEqual(programClass1, programClass2);
            Assert.AreEqual(programClass1.GetHashCode(), programClass2.GetHashCode());
        }
コード例 #2
0
        public void TestProgramClassType_3()
        {
            string           name      = "TestName";
            List <string>    modifiers = new List <string>();
            List <string>    list      = new List <string>();
            ProgramClass     programClass;
            ProgramInterface programInterface;
            ProgramClass     subclass;

            modifiers.Add("private");

            subclass = new ProgramClass("Subclass", list, list);

            programClass     = new ProgramClass(name, modifiers, list);
            programInterface = new ProgramInterface(name, modifiers, list);

            programClass.SubClasses.Add(subclass);
            programInterface.SubClasses.Add(subclass);

            Assert.AreNotEqual(programClass, programInterface);
            Assert.AreNotEqual(programClass.GetHashCode(), programInterface.GetHashCode());
        }