private void TestObjectAPI(Monster a) { var b = a.UnPack(); AreEqual(a, b); var fbb = new FlatBufferBuilder(1); fbb.Finish(Monster.Pack(fbb, b).Value); var c = Monster.GetRootAsMonster(fbb.DataBuffer); AreEqual(a, c); var jsonText = b.SerializeToJson(); var d = MonsterT.DeserializeFromJson(jsonText); AreEqual(a, d); var fbBuffer = b.SerializeToBinary(); Assert.IsTrue(Monster.MonsterBufferHasIdentifier(new ByteBuffer(fbBuffer))); var e = MonsterT.DeserializeFromBinary(fbBuffer); AreEqual(a, e); }
public void CanReadJsonFile() { var jsonText = File.ReadAllText(@"../monsterdata_test.json"); var mon = MonsterT.DeserializeFromJson(jsonText); var fbb = new FlatBufferBuilder(1); fbb.Finish(Monster.Pack(fbb, mon).Value); TestBuffer(fbb.DataBuffer); }
private void TestObjectAPI(Monster a) { var b = a.UnPack(); AreEqual(a, b); var fbb = new FlatBufferBuilder(1); fbb.Finish(Monster.Pack(fbb, b).Value); var c = Monster.GetRootAsMonster(fbb.DataBuffer); AreEqual(a, c); var jsonText = b.SerializeToJson(); var d = MonsterT.DeserializeFromJson(jsonText); AreEqual(a, d); }