AjTalk.Tests.Compiler.SimpleCompilerTests.ExecuteRedefinedNew C# (CSharp) Метод

ExecuteRedefinedNew() приватный Метод

private ExecuteRedefinedNew ( ) : void
Результат void
        public void ExecuteRedefinedNew()
        {
            Machine machine = new Machine();

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

            machine.SetGlobalObject("Rectangle", cls);

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

            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]);
        }
SimpleCompilerTests