예제 #1
0
        public void GetAssociatedClassSameName()
        {
            Machine hostmachine = new Machine();
            IClass hostklass = hostmachine.CreateClass("Rectangle");
            hostmachine.SetGlobalObject(hostklass.Name, hostklass);

            Machine machine = new Machine();
            IClass klass = machine.CreateClass("Rectangle");
            machine.SetGlobalObject(klass.Name, klass);

            var result = hostmachine.GetAssociatedClass(klass);

            Assert.IsNotNull(result);
            Assert.AreSame(hostklass, result);
        }
예제 #2
0
        public void NotAssociatedSuperClass()
        {
            Machine hostmachine = new Machine();

            Machine machine = new Machine();
            IClass superclass = machine.CreateClass("Figure");
            machine.SetGlobalObject(superclass.Name, superclass);
            IClass klass = machine.CreateClass("Rectangle", superclass);
            machine.SetGlobalObject(klass.Name, klass);

            var result = hostmachine.GetAssociatedClass(klass);

            Assert.IsNotNull(result);
            Assert.AreSame(hostmachine.UndefinedObjectClass, result);
        }