AjTalk.Tests.Compiler.ParserTests.ExecuteRedefinedNew C# (CSharp) 메소드

ExecuteRedefinedNew() 개인적인 메소드

private ExecuteRedefinedNew ( ) : void
리턴 void
        public void ExecuteRedefinedNew()
        {
            Machine machine = new Machine();

            IClass cls = CompileClass(
                "Rectangle",
                new string[] { "x", "y" },
                new string[] { "initialize x := 10. y := 20" },
                new string[] { "new ^self basicNew initialize" });

            machine.SetGlobalObject("Rectangle", cls);

            Parser compiler = new Parser("^Rectangle new");
            Block block = compiler.CompileBlock();

            Assert.IsNotNull(block);

            object obj = block.Execute(machine, null);

            Assert.IsNotNull(obj);
            Assert.IsInstanceOfType(obj, typeof(IObject));
            Assert.AreEqual(cls, ((IObject)obj).Behavior);

            IObject iobj = (IObject)obj;

            Assert.AreEqual(2, iobj.Behavior.NoInstanceVariables);
            Assert.AreEqual(10, iobj[0]);
            Assert.AreEqual(20, iobj[1]);
        }
ParserTests