public void T01_SimpleWriteRead() { BlockStream blocks = new BlockStream(); blocks.CreateMemoryStream(); Guid id = Guid.NewGuid(); Hashtable tags0 = new Hashtable(); tags0["Name"] = "Test Write"; tags0["Description"] = "Simple Write/Read Test."; byte[] bytes0 = new byte[256]; for (int ndx = 0; ndx < 256; ndx++) { bytes0[ndx] = (byte)ndx; } blocks.WriteBlock(id, tags0, bytes0); Hashtable tags1 = null; byte[] bytes1 = null; blocks.ReadBlock(id, ref tags1, ref bytes1); //Assert.IsTrue( DataManagement.AreEqual( tags0, tags1 ) ); Assert.IsTrue(DataManagement.AreEqual(bytes0, bytes1)); return; }
//--------------------------------------------------------------------- private void AssertIsValid(BlockStream Blocks) { foreach (Guid id in Blocks.GetBlockIDs()) { if (!(id.Equals(Guid.Empty))) { Hashtable tags = null; byte[] bytes = null; Blocks.ReadBlock(id, ref tags, ref bytes); this.AssertIsValid(tags, bytes); } } return; }
public void T11_SequentialWriteRead() { BlockStream blocks = new BlockStream(); blocks.CreateMemoryStream(); int TestIterations = 300; for (int TestNumber = 1; TestNumber <= TestIterations; TestNumber++) { Guid id = Guid.NewGuid(); Hashtable tags0 = this.NewTestTags(TestNumber); byte[] bytes0 = this.NewTestBytes(TestNumber); blocks.WriteBlock(id, tags0, bytes0); Hashtable tags1 = null; byte[] bytes1 = null; blocks.ReadBlock(id, ref tags1, ref bytes1); //Assert.IsTrue( DataManagement.AreEqual( tags0, tags1 ) ); Assert.IsTrue(DataManagement.AreEqual(bytes0, bytes1)); } return; }