public void Serialize_TestTableWithNestedTestTable1_CanBeReadByOracle()
        {
            const int   intProp   = 123456;
            const byte  byteProp  = 42;
            const short shortProp = 1024;

            var nested = new TestTable1()
            {
                IntProp   = intProp,
                ByteProp  = byteProp,
                ShortProp = shortProp
            };

            var obj = new TestTableWithNestedTestTable1()
            {
                IntProp = 2048,
                Nested  = nested
            };

            var buffer = FlatBuffersConvert.SerializeObject(obj);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTableWithNestedTable1(buffer);

            Assert.AreEqual(2048, oracleResult.IntProp);

            var oracleResult1 = oracleResult.Nested as TestTable1;

            Assert.IsNotNull(oracleResult1);
            Assert.AreEqual(intProp, oracleResult1.IntProp);
            Assert.AreEqual(byteProp, oracleResult1.ByteProp);
            Assert.AreEqual(shortProp, oracleResult1.ShortProp);
        }
        public void Oracle_WithTestTableWithTable_CanReadGeneratedData()
        {
            const int   intProp   = 42;
            const byte  byteProp  = 22;
            const short shortProp = 62;

            var testTable = new TestTable1()
            {
                IntProp = intProp, ShortProp = shortProp, ByteProp = byteProp
            };

            var obj = new TestTableWithTable()
            {
                TableProp = testTable, IntProp = 1024
            };

            var oracle = new SerializationTestOracle();

            var buffer = oracle.GenerateTestTableWithTable(testTable, 1024);

            var oracleResult = oracle.ReadTestTableWithTable(buffer);

            Assert.AreEqual(obj.IntProp, oracleResult.IntProp);
            Assert.AreEqual(obj.TableProp.IntProp, oracleResult.TableProp.IntProp);
            Assert.AreEqual(obj.TableProp.ByteProp, oracleResult.TableProp.ByteProp);
            Assert.AreEqual(obj.TableProp.ShortProp, oracleResult.TableProp.ShortProp);
        }
        public void Serialize_WithTestStruct2_CanBeReadByOracle()
        {
            const int   outerIntProp = 102;
            const int   intProp      = 42;
            const byte  byteProp     = 22;
            const short shortProp    = 62;

            var serializer = new FlatBuffersSerializer();

            var obj = new TestStruct1()
            {
                IntProp = intProp, ByteProp = byteProp, ShortProp = shortProp
            };
            var root = new TestStruct2()
            {
                IntProp = outerIntProp, TestStructProp = obj
            };

            var buffer = new byte[32];

            serializer.Serialize(root, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestStruct2(buffer);

            Assert.AreEqual(root.IntProp, oracleResult.IntProp);

            Assert.AreEqual(root.TestStructProp.IntProp, oracleResult.TestStructProp.IntProp);
            Assert.AreEqual(root.TestStructProp.ByteProp, oracleResult.TestStructProp.ByteProp);
            Assert.AreEqual(root.TestStructProp.ShortProp, oracleResult.TestStructProp.ShortProp);
        }
        public void Serialize_WithTestTableWithArrayOfStrings_CanBeReadByOracle()
        {
            var serializer = new FlatBuffersSerializer();
            var obj        = new TestTableWithArrayOfStrings()
            {
                StringArrayProp = new []
                {
                    "Hello",
                    "World"
                },
                StringListProp = new List <string>
                {
                    "Lorem",
                    "ipsum"
                }
            };

            var buffer = new byte[128];

            serializer.Serialize(obj, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTableWithArrayOfStrings(buffer);

            Assert.IsTrue(oracleResult.StringArrayProp[0].Equals(obj.StringArrayProp[0]));
            Assert.IsTrue(oracleResult.StringArrayProp[1].Equals(obj.StringArrayProp[1]));
            Assert.IsTrue(oracleResult.StringListProp[0].Equals(obj.StringListProp[0]));
            Assert.IsTrue(oracleResult.StringListProp[1].Equals(obj.StringListProp[1]));
        }
        public void Serialize_WithTestTableWithArrayOfStructs_CanBeReadByOracle()
        {
            var serializer = new FlatBuffersSerializer();
            var obj        = new TestTableWithArrayOfStructs()
            {
                StructArray = new[]
                {
                    new TestStruct1()
                    {
                        ByteProp = 42, IntProp = 100, ShortProp = -50
                    },
                    new TestStruct1()
                    {
                        ByteProp = 142, IntProp = 1000, ShortProp = -150
                    },
                }
            };

            var buffer = new byte[128];

            serializer.Serialize(obj, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTableWithArrayOfStructs(buffer);

            Assert.IsTrue(oracleResult.StructArray[0].Equals(obj.StructArray[0]));
            Assert.IsTrue(oracleResult.StructArray[1].Equals(obj.StructArray[1]));
        }
        public void Deserialize_FromOracleData_WithTestTableWithUnionAndMoreFields_And_TestTable1()
        {
            var table1 = new TestTable1()
            {
                IntProp   = 42,
                ByteProp  = 22,
                ShortProp = 62,
            };

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithUnionAndMoreFields(1024, "Hello, FlatBuffers", 123.5f, 3.14, testTable1Prop: table1);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithUnionAndMoreFields>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(1024, o.IntProp);
            Assert.AreEqual("Hello, FlatBuffers", o.StringProp);
            Assert.AreEqual(123.5f, o.FloatProp);
            Assert.AreEqual(3.14, o.DoubleProp);

            Assert.IsInstanceOf <TestTable1>(o.UnionProp);

            var o1 = o.UnionProp as TestTable1;

            Assert.AreEqual(table1.IntProp, o1.IntProp);
            Assert.AreEqual(table1.ShortProp, o1.ShortProp);
            Assert.AreEqual(table1.ByteProp, o1.ByteProp);
        }
        public void Serialize_WithTestTableWithTable_CanBeReadByOracle()
        {
            const int   intProp   = 42;
            const byte  byteProp  = 22;
            const short shortProp = 62;

            var serializer = new FlatBuffersSerializer();

            var testTable = new TestTable1()
            {
                IntProp = intProp, ShortProp = shortProp, ByteProp = byteProp
            };

            var obj = new TestTableWithTable()
            {
                TableProp = testTable, IntProp = 1024
            };

            var buffer = new byte[256];

            serializer.Serialize(obj, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTableWithTable(buffer);

            Assert.AreEqual(obj.IntProp, oracleResult.IntProp);
            Assert.AreEqual(obj.TableProp.IntProp, oracleResult.TableProp.IntProp);
            Assert.AreEqual(obj.TableProp.ByteProp, oracleResult.TableProp.ByteProp);
            Assert.AreEqual(obj.TableProp.ShortProp, oracleResult.TableProp.ShortProp);
        }
        public void Serialize_TestTableWithUnion_And_TestTable1_CanBeReadByOracle()
        {
            const int   intProp   = 123456;
            const byte  byteProp  = 42;
            const short shortProp = 1024;

            var table1 = new TestTable1()
            {
                IntProp   = intProp,
                ByteProp  = byteProp,
                ShortProp = shortProp
            };

            var obj = new TestTableWithUnion()
            {
                IntProp   = 512,
                UnionProp = table1
            };

            var buffer = FlatBuffersConvert.SerializeObject(obj);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTableWithUnion(buffer);

            Assert.AreEqual(512, oracleResult.IntProp);
            Assert.AreEqual(typeof(TestTable1), oracleResult.UnionProp.GetType());

            var oracleResult1 = oracleResult.UnionProp as TestTable1;

            Assert.IsNotNull(oracleResult1);
            Assert.AreEqual(intProp, oracleResult1.IntProp);
            Assert.AreEqual(byteProp, oracleResult1.ByteProp);
            Assert.AreEqual(shortProp, oracleResult1.ShortProp);
        }
        public void Serialize_WithTestTableWithOriginalOrdering_CanBeReadByOracle_And_CompatibleWithTestTable1()
        {
            const int   intProp   = 123456;
            const byte  byteProp  = 42;
            const short shortProp = 1024;

            var serializer = new FlatBuffersSerializer();

            var obj = new TestTableWithOriginalOrdering()
            {
                IntProp   = intProp,
                ByteProp  = byteProp,
                ShortProp = shortProp
            };

            var buffer = new byte[32];

            serializer.Serialize(obj, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTable1(buffer);

            Assert.AreEqual(intProp, oracleResult.IntProp);
            Assert.AreEqual(byteProp, oracleResult.ByteProp);
            Assert.AreEqual(shortProp, oracleResult.ShortProp);
        }
        public void Serialize_TestTableWithUnion_And_TestTable2_CanBeReadByOracle()
        {
            const string stringProp = "Hello, FlatBuffers!";

            var table2 = new TestTable2()
            {
                StringProp = stringProp
            };

            var obj = new TestTableWithUnion()
            {
                IntProp   = 512,
                UnionProp = table2
            };

            var buffer = FlatBuffersConvert.SerializeObject(obj);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTableWithUnion(buffer);

            Assert.AreEqual(512, oracleResult.IntProp);
            Assert.AreEqual(typeof(TestTable2), oracleResult.UnionProp.GetType());

            var oracleResult2 = oracleResult.UnionProp as TestTable2;

            Assert.IsNotNull(oracleResult2);
            Assert.AreEqual(stringProp, oracleResult2.StringProp);
        }
        public void Deserialize_FromOracleData_WithTestTable3()
        {
            const bool     boolProp   = true;
            const long     longProp   = 1020304050;
            const sbyte    sbyteProp  = -127;
            const ushort   ushortProp = 2048;
            const ulong    ulongProp  = 9999999999999999999;
            const TestEnum enumProp   = TestEnum.Banana;
            const float    floatProp  = 3.14f;
            const double   doubleProp = 6.22910783293;

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTable3(boolProp, longProp, sbyteProp, ushortProp, ulongProp, enumProp, floatProp, doubleProp);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTable3>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(boolProp, o.BoolProp);
            Assert.AreEqual(longProp, o.LongProp);
            Assert.AreEqual(sbyteProp, o.SByteProp);
            Assert.AreEqual(ushortProp, o.UShortProp);
            Assert.AreEqual(ulongProp, o.ULongProp);
            Assert.AreEqual(enumProp, o.EnumProp);
            Assert.AreEqual(floatProp, o.FloatProp);
            Assert.AreEqual(doubleProp, o.DoubleProp);
        }
        public void Serialize_WithTestTable3_CanBeReadByOracle()
        {
            var serializer = new FlatBuffersSerializer();

            var obj = new TestTable3()
            {
                EnumProp   = TestEnum.Banana,
                BoolProp   = true,
                LongProp   = 1020304050,
                SByteProp  = -127,
                ULongProp  = 9999999999999999999,
                UShortProp = 2048,
                FloatProp  = 3.14f,
                DoubleProp = 6.22910783293
            };

            var buffer = new byte[128];

            serializer.Serialize(obj, buffer, 0, buffer.Length);


            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTable3(buffer);

            Assert.AreEqual(obj.BoolProp, oracleResult.BoolProp);
            Assert.AreEqual(obj.LongProp, oracleResult.LongProp);
            Assert.AreEqual(obj.DoubleProp, oracleResult.DoubleProp);
            Assert.AreEqual(obj.FloatProp, oracleResult.FloatProp);
            Assert.AreEqual(obj.EnumProp, oracleResult.EnumProp);
            Assert.AreEqual(obj.ULongProp, oracleResult.ULongProp);
            Assert.AreEqual(obj.SByteProp, oracleResult.SByteProp);
            Assert.AreEqual(obj.UShortProp, oracleResult.UShortProp);
        }
        public void Deserialize_FromOracleData_WithTestTableWithUnion_And_TestTable1()
        {
            var table1 = new TestTable1()
            {
                IntProp   = 42,
                ByteProp  = 22,
                ShortProp = 62,
            };

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithUnion(1024, testTable1Prop: table1);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithUnion>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(1024, o.IntProp);

            Assert.IsInstanceOf <TestTable1>(o.UnionProp);

            var o1 = o.UnionProp as TestTable1;

            Assert.AreEqual(table1.IntProp, o1.IntProp);
            Assert.AreEqual(table1.ShortProp, o1.ShortProp);
            Assert.AreEqual(table1.ByteProp, o1.ByteProp);
        }
        public void Deserialize_FromOracleData_WithTestTableWithIdentifier()
        {
            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithIdentifier(42);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithIdentifier>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(42, o.IntProp);
        }
        public void Deserialize_FromOracleData_WithTestTable2_AndNullString()
        {
            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTable2(null);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTable2>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(null, o.StringProp);
        }
        public void Deserialize_FromOracleData_WithTestTable2()
        {
            const string stringProp = "Hello, FlatBuffers!";

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTable2(stringProp);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTable2>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(stringProp, o.StringProp);
        }
        public void Deserialize_FromOracleData_WithTestTableWithUnion_And_NoTables_ReturnsNullForUnion()
        {
            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithUnion(1024);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithUnion>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(1024, o.IntProp);

            Assert.IsNull(o.UnionProp);
        }
        public void Serialize_WithTestTableWithArrayOfTables_CanBeReadByOracle()
        {
            var serializer = new FlatBuffersSerializer();

            var obj = new TestTableWithArrayOfTables()
            {
                TableArrayProp = new []
                {
                    new TestTable1()
                    {
                        IntProp = 1, ShortProp = 2, ByteProp = 3
                    },
                    new TestTable1()
                    {
                        IntProp = 4, ShortProp = 5, ByteProp = 6
                    }
                },
                TableListProp = new List <TestTable1>()
                {
                    new TestTable1()
                    {
                        IntProp = 7, ShortProp = 8, ByteProp = 9
                    },
                    new TestTable1()
                    {
                        IntProp = 10, ShortProp = 11, ByteProp = 12
                    }
                }
            };

            var buffer = new byte[256];

            serializer.Serialize(obj, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTableWithArrayOfTables(buffer);

            Assert.AreEqual(obj.TableArrayProp[0].IntProp, oracleResult.TableArrayProp[0].IntProp);
            Assert.AreEqual(obj.TableArrayProp[0].ByteProp, oracleResult.TableArrayProp[0].ByteProp);
            Assert.AreEqual(obj.TableArrayProp[0].ShortProp, oracleResult.TableArrayProp[0].ShortProp);
            Assert.AreEqual(obj.TableArrayProp[1].IntProp, oracleResult.TableArrayProp[1].IntProp);
            Assert.AreEqual(obj.TableArrayProp[1].ByteProp, oracleResult.TableArrayProp[1].ByteProp);
            Assert.AreEqual(obj.TableArrayProp[1].ShortProp, oracleResult.TableArrayProp[1].ShortProp);

            Assert.AreEqual(obj.TableListProp[0].IntProp, oracleResult.TableListProp[0].IntProp);
            Assert.AreEqual(obj.TableListProp[0].ByteProp, oracleResult.TableListProp[0].ByteProp);
            Assert.AreEqual(obj.TableListProp[0].ShortProp, oracleResult.TableListProp[0].ShortProp);
            Assert.AreEqual(obj.TableListProp[1].IntProp, oracleResult.TableListProp[1].IntProp);
            Assert.AreEqual(obj.TableListProp[1].ByteProp, oracleResult.TableListProp[1].ByteProp);
            Assert.AreEqual(obj.TableListProp[1].ShortProp, oracleResult.TableListProp[1].ShortProp);
        }
        public void Serialize_WithTestTable2_AndNullString_CanBeReadByOracle()
        {
            var serializer = new FlatBuffersSerializer();

            var obj = new TestTable2();

            var buffer = new byte[64];

            serializer.Serialize(obj, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTable2(buffer);

            Assert.IsNull(oracleResult.StringProp);
        }
        public void Deserialize_FromOracleData_WithTestTableWithDeprecatedField()
        {
            const int   intProp   = 42;
            const short shortProp = 62;

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithDeprecatedField(intProp, shortProp);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithDeprecatedField>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(intProp, o.IntProp);
            Assert.AreEqual(TestTableWithDeprecatedField.DefaultBytePropValue, o.ByteProp); // no value
            Assert.AreEqual(shortProp, o.ShortProp);
        }
        public void Serialize_TestTableWithIdentifier_CanBeReadByOracle()
        {
            const int intProp = 123456;

            var obj = new TestTableWithIdentifier()
            {
                IntProp = intProp,
            };

            var buffer       = FlatBuffersConvert.SerializeObject(obj);
            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTableWithIdentifier(buffer);

            Assert.AreEqual(intProp, oracleResult.IntProp);
        }
        public void Deserialize_FromOracleData_WithTestTableWithArray()
        {
            var intArray = new int[] { 1, 2, 3, 4, 5 };
            var intList  = new List <int> {
                6, 7, 8, 9, 0
            };

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithArray(intArray, intList);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithArray>(oracleResult, 0, oracleResult.Length);

            Assert.IsTrue(o.IntArray.SequenceEqual(intArray));
            Assert.IsTrue(o.IntList.SequenceEqual(intList));
        }
        public void Deserialize_FromOracleData_WithTestTableWithArrayOfStrings()
        {
            var stringArray = new string[] { "Hello", "World" };
            var stringList  = new List <string> {
                "Lorem", "ipsum"
            };

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithArrayOfStrings(stringArray, stringList);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithArrayOfStrings>(oracleResult, 0, oracleResult.Length);

            Assert.IsTrue(o.StringArrayProp.SequenceEqual(stringArray));
            Assert.IsTrue(o.StringListProp.SequenceEqual(stringList));
        }
        public void Deserialize_FromOracleData_WithTestTableWithDefaults()
        {
            const int   intProp   = 123456;
            const byte  byteProp  = 42;
            const short shortProp = 1024;

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithDefaults();

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithDefaults>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(intProp, o.IntProp);
            Assert.AreEqual(byteProp, o.ByteProp);
            Assert.AreEqual(shortProp, o.ShortProp);
        }
        public void Deserialize_FromOracleData_WithTestTableWithOriginalOrdering_CompatibleWithTestTable1()
        {
            const int   intProp   = 42;
            const byte  byteProp  = 22;
            const short shortProp = 62;

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithOriginalOrdering(intProp, byteProp, shortProp);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTable1>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(intProp, o.IntProp);
            Assert.AreEqual(byteProp, o.ByteProp);
            Assert.AreEqual(shortProp, o.ShortProp);
        }
        public void Serialize_TestTable1UsingFieldsAndDefaultFieldValues_CanBeReadByOracleAsTestTable1()
        {
            var serializer = new FlatBuffersSerializer();

            var obj = new TestTable1UsingFieldsAndDefaultFieldValues();  // relying on the flatbuffers defaults

            var buffer = new byte[32];

            serializer.Serialize(obj, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTable1(buffer);

            Assert.AreEqual(0, oracleResult.IntProp);   // values are all zero as the defaults matched the values in the struct
            Assert.AreEqual(0, oracleResult.ByteProp);
            Assert.AreEqual(0, oracleResult.ShortProp);
        }
        public void Deserialize_FromOracleData_WithTestTableWithNestedTestTable1()
        {
            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithNestedTestTable1(1024, 42, 22, 62);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithNestedTestTable1>(oracleResult, 0, oracleResult.Length);

            Assert.IsInstanceOf <TestTable1>(o.Nested);

            var nested = o.Nested as TestTable1;

            Assert.AreEqual(1024, o.IntProp);
            Assert.AreEqual(42, nested.IntProp);
            Assert.AreEqual(22, nested.ByteProp);
            Assert.AreEqual(62, nested.ShortProp);
        }
        public void Serialize_WithTestTable2_CanBeReadByOracle()
        {
            const string stringProp = "Hello, FlatBuffers!";
            var          serializer = new FlatBuffersSerializer();

            var obj = new TestTable2()
            {
                StringProp = stringProp
            };

            var buffer = new byte[64];

            serializer.Serialize(obj, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTable2(buffer);

            Assert.AreEqual(obj.StringProp, oracleResult.StringProp);
        }
        public void Serialize_WithTestTableWithArray_CanBeReadByOracle()
        {
            var serializer = new FlatBuffersSerializer();
            var obj        = new TestTableWithArray()
            {
                IntArray = new[] { 1, 2, 3, 4, 5 },
                IntList  = new List <int>(new[] { 6, 7, 8, 9, 0 })
            };

            var buffer = new byte[128];

            serializer.Serialize(obj, buffer, 0, buffer.Length);

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.ReadTestTableWithArray(buffer);

            Assert.IsTrue(obj.IntArray.SequenceEqual(oracleResult.IntArray));
            Assert.IsTrue(obj.IntList.SequenceEqual(oracleResult.IntList));
        }
        public void Deserialize_FromOracleData_WithTestTableWithArrayOfTables()
        {
            var tableArray = new TestTable1[]
            {
                new TestTable1 {
                    ByteProp = 1, IntProp = 2, ShortProp = 3
                },
                new TestTable1 {
                    ByteProp = 4, IntProp = 5, ShortProp = 6
                },
            };

            var tableList = new List <TestTable1>
            {
                new TestTable1 {
                    ByteProp = 7, IntProp = 8, ShortProp = 9
                },
                new TestTable1 {
                    ByteProp = 10, IntProp = 11, ShortProp = 12
                },
            };

            var oracle       = new SerializationTestOracle();
            var oracleResult = oracle.GenerateTestTableWithArrayOfTables(tableArray, tableList);

            var serializer = new FlatBuffersSerializer();
            var o          = serializer.Deserialize <TestTableWithArrayOfTables>(oracleResult, 0, oracleResult.Length);

            Assert.AreEqual(o.TableArrayProp[0].IntProp, tableArray[0].IntProp);
            Assert.AreEqual(o.TableArrayProp[0].ByteProp, tableArray[0].ByteProp);
            Assert.AreEqual(o.TableArrayProp[0].ShortProp, tableArray[0].ShortProp);
            Assert.AreEqual(o.TableArrayProp[1].IntProp, tableArray[1].IntProp);
            Assert.AreEqual(o.TableArrayProp[1].ByteProp, tableArray[1].ByteProp);
            Assert.AreEqual(o.TableArrayProp[1].ShortProp, tableArray[1].ShortProp);

            Assert.AreEqual(o.TableListProp[0].IntProp, tableList[0].IntProp);
            Assert.AreEqual(o.TableListProp[0].ByteProp, tableList[0].ByteProp);
            Assert.AreEqual(o.TableListProp[0].ShortProp, tableList[0].ShortProp);
            Assert.AreEqual(o.TableListProp[1].IntProp, tableList[1].IntProp);
            Assert.AreEqual(o.TableListProp[1].ByteProp, tableList[1].ByteProp);
            Assert.AreEqual(o.TableListProp[1].ShortProp, tableList[1].ShortProp);
        }