예제 #1
0
        public void GetAssociatedMetaClassSameName()
        {
            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.GetAssociatedMetaClass((IMetaClass)klass.Behavior);

            Assert.IsNotNull(result);
            Assert.AreSame(hostklass.Behavior, result);
        }
예제 #2
0
        public void NoAssociatedSuperMetaClass()
        {
            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.GetAssociatedMetaClass((IMetaClass)klass.Behavior);

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