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); }
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); }
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(); } }
public RelayTwo Subset(string pTableName, Func <TableRow, bool> pPredicate) { RelayTwo relaySubset = new RelayTwo(); TableTwo tableSubset = relaySubset.CreateTable(pTableName); TableTwo sourceTable = tables[pTableName]; foreach (ITableField f in sourceTable.fields) { tableSubset.AddField(f.GetEmptyCopy()); } tableSubset.SetCapacity(sourceTable.capacity); foreach (TableRow sourceRow in sourceTable.Where(pPredicate)) { SerializableTableRow newRow = sourceRow.GetSerializableTableRow(); newRow.InsertToTable(tableSubset); //Console.WriteLine("added row " + newRow.row); } return(relaySubset); }