예제 #1
0
 public void NonExistingFieldTest()
 {
     RelayLib.RelayTwo r2 = new RelayLib.RelayTwo();
     r2.CreateTable(TingTing.Ting.TABLE_NAME);
     r2.CreateTable(TingTing.Room.TABLE_NAME);
     RoomRunner rr =  new TingTing.RoomRunner(r2);
     rr.CreateRoom<Room>(WorldCoordinate.UNDEFINED_ROOM);
     TingTing.TingRunner tr = new TingTing.TingRunner(r2,rr);
     tr.CreateTing<SomeLesserTing>("TingA", TingTing.WorldCoordinate.NONE);
     r2.GetTable(TingTing.Ting.TABLE_NAME)[0].Set<string>(TingTing.Ting.CSHARP_CLASS_FIELD_NAME, "TerreTingThongDong");
     List<TingTing.Ting> list = InstantiatorTwo.Process<TingTing.Ting>(r2.GetTable(TingTing.Ting.TABLE_NAME));
     Console.WriteLine("list length" + list.Count);
     Assert.NotNull((list[0] as TerreTingThongDong));
     Assert.AreSame("Something", (list[0] as TerreTingThongDong).funk);
 }
예제 #2
0
        public void NonExistingFieldTest()
        {
            RelayLib.RelayTwo r2 = new RelayLib.RelayTwo();
            r2.CreateTable(TingTing.Ting.TABLE_NAME);
            r2.CreateTable(TingTing.Room.TABLE_NAME);
            RoomRunner rr = new TingTing.RoomRunner(r2);

            rr.CreateRoom <Room>(WorldCoordinate.UNDEFINED_ROOM);
            TingTing.TingRunner tr = new TingTing.TingRunner(r2, rr);
            tr.CreateTing <SomeLesserTing>("TingA", TingTing.WorldCoordinate.NONE);
            r2.GetTable(TingTing.Ting.TABLE_NAME)[0].Set <string>(TingTing.Ting.CSHARP_CLASS_FIELD_NAME, "TerreTingThongDong");
            List <TingTing.Ting> list = InstantiatorTwo.Process <TingTing.Ting>(r2.GetTable(TingTing.Ting.TABLE_NAME));

            Console.WriteLine("list length" + list.Count);
            Assert.NotNull((list[0] as TerreTingThongDong));
            Assert.AreSame("Something", (list[0] as TerreTingThongDong).funk);
        }
예제 #3
0
        public RelayTreeRunner(RelayTwo pRelay, string pTableName)
        {
            D.isNull(pRelay);
            if (!pRelay.tables.ContainsKey(pTableName))
            {
                pRelay.CreateTable(pTableName);
            }
            _table = pRelay.GetTable(pTableName);
            List <RelayTreeNode> nodes = InstantiatorTwo.Process <RelayTreeNode>(_table);

            foreach (RelayTreeNode t in nodes)
            {
                D.assert(t.hasSetupCells, "an object of type " + t.GetType().Name + " did not call base method of SetupCells");
                _nodes.Add(t.objectId, t);
                t.SetRunner(this);
            }
            foreach (RelayTreeNode t in nodes)
            {
                t.RestoreRelations();
            }
        }