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(Hashtable Tags, byte[] Bytes) { Assert.IsTrue(Tags.ContainsKey("TestNumber")); int TestNumber = (int)Tags["TestNumber"]; Hashtable tags = this.NewTestTags(TestNumber); byte[] bytes = this.NewTestBytes(TestNumber); //Assert.IsTrue( DataManagement.AreEqual( Tags, tags ) ); Assert.IsTrue(DataManagement.AreEqual(Bytes, 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; }