private static byte[] GetResolvedTestData() { var table = new WriteTable<TestData>(new DataConverter<TestData>()); foreach (var entry in TestData) table.Add(entry.Key, entry.Data); return table.Resolve(); }
public void NestedTables() { var testTableByteArray = GetResolvedTestData(); var nestTable = new WriteTable<byte[]>(new ByteArrayConverter()); nestTable.Add("table1", testTableByteArray); nestTable.Add("table2", testTableByteArray); var data = nestTable.Resolve(); using (var readOnlyByteArray = new ReadOnlyByteArray(data)) { var table = new ReadTable<byte[]>(new ByteArrayConverter(), readOnlyByteArray); byte[] readTableBytes; Assert.IsTrue(table.TryGetValue("table1", out readTableBytes)); Assert.IsTrue(readTableBytes.Where((b, i) => b != testTableByteArray[i]).Count() == 0); Assert.IsTrue(table.TryGetValue("table2", out readTableBytes)); Assert.IsTrue(readTableBytes.Where((b, i) => b != testTableByteArray[i]).Count() == 0); } }