Ejemplo n.º 1
0
        public void Test23_2()
        {
            var code = @"
                    p = new Process
                        Name = 'TestProc'
                    p.Name = 'ChangedName'
                ";
            var jac  = JacInterpreter.From(code);
            var p    = jac.GetProcess("p");

            Assert.IsNotNull(p);
            Assert.AreEqual(p.Name, "ChangedName");
        }
Ejemplo n.º 2
0
        public void Test24()
        {
            var code = @"
                    new Process
                        ID = 'TestProc'
                        AAA = 123   // When Process has NOT property named AAA then, call JacSetDotValueAttribute
                        BBB = 456   // Same
                ";
            var jac  = JacInterpreter.From(code);
            var p    = jac.GetProcess("TestProc");

            Assert.IsNotNull(p);
            Assert.AreEqual(p.ChildVriables["AAA"]?.Value, 123);
            Assert.AreEqual(p.ChildVriables["BBB"]?.Value, 456);
        }
Ejemplo n.º 3
0
        public void Test22()
        {
            var code = @"
                    p = new Process
                    p.X = 1234
                    p.Y = '5678' // Jac parser deeply makes to integer 5678
                    p.Z = p.X
                ";
            var jac  = JacInterpreter.From(code);

            Assert.IsNotNull(jac.GetProcess("p"));
            Assert.AreEqual(jac.GetProcess("p").ChildVriables["X"]?.Value, 1234);
            Assert.AreEqual(jac.GetProcess("p").ChildVriables["Y"]?.Value, "5678");  // To check '5678' is as string
            Assert.AreEqual(jac.GetProcess("p").ChildVriables["Z"]?.Value, 1234);
        }
Ejemplo n.º 4
0
        public void Test23()
        {
            var code = @"
                    p = new Process
                        Name = 'TestProc'
                    a123 = new Variable
                    a123.AAA = p
                    a123.BBB = p.Name   // To check that a123.BBB reference equals to p.Name
                ";
            var jac  = JacInterpreter.From(code);
            var p    = jac.GetProcess("p");
            var a123 = jac.GetVariable("a123");

            Assert.IsNotNull(p);
            Assert.IsTrue(a123.ChildVriables["AAA"].Is(":Process"));
            Assert.IsTrue(a123.ChildVriables["AAA"].Value is JitProcess);
            Assert.AreEqual(((JitProcess)a123.ChildVriables["AAA"].Value).Name, "TestProc");
            Assert.IsTrue(a123.ChildVriables["BBB"].Is(JitProcess.Class.String));
            Assert.AreEqual(a123.ChildVriables["BBB"].Value, "TestProc");
        }
Ejemplo n.º 5
0
        public void Test03()
        {
            var c   = @"
                te = new Template
                    Block
                        add 'st = new Stage'
                        add 'p1 = new Process'
                        add 'w1 = new Work'
                        add 'k1 = new Kanban'
            ";
            var jac = new JacInterpreter();

            jac.Exec(c);

            var jac2 = JacInterpreter.From(jac.GetTemplate("te"));

            Assert.IsNotNull(jac2.GetStage("st"));
            Assert.IsNotNull(jac2.GetProcess("p1"));
            Assert.IsNotNull(jac2.GetWork("w1"));
            Assert.IsNotNull(jac2.GetKanban("k1"));
            Assert.IsNull(jac2.GetTemplate("te")); // child JacInterpreter should has NOT the template instance
        }