public void TestAddGet() { var db = new MetaCollectionDb(); var intCol = db.AddInt32("int"); intCol[1023] = 1; var dblCol = db.AddDouble("double"); dblCol[1023] = 1; Assert.IsTrue(db.TryGet <int>("int", out intCol)); Assert.IsTrue(db.TryGet <double>("double", out dblCol)); }
public void TestSerializeDeserialize() { var db = new MetaCollectionDb(); var intCol = db.AddInt32("int"); var dblCol = db.AddDouble("double"); var size = 15213; for (uint i = 0; i < size; i++) { intCol[i] = (int)(i * 2); } for (uint i = 0; i < size; i++) { dblCol[i] = i * .1; } using (var stream = new MemoryStream()) { db.Serialize(stream); stream.Seek(0, SeekOrigin.Begin); db = MetaCollectionDb.Deserialize(stream, null); } Assert.IsTrue(db.TryGet <int>("int", out intCol)); Assert.IsTrue(db.TryGet <double>("double", out dblCol)); for (uint i = 0; i < intCol.Count; i++) { Assert.AreEqual((int)i * 2, intCol[i]); } for (uint i = 0; i < dblCol.Count; i++) { Assert.AreEqual(i * .1, dblCol[i]); } }