public void TestReadPropertyMultiple() { byte[] data1 = Combine(_nameData1, _typeData, _sizeData1, _valueData1); byte[] data2 = Combine(_nameData2, _typeData, _sizeData2, _valueData2); byte[] both = new byte[data1.Length + data2.Length]; Buffer.BlockCopy(data1, 0, both, 0, data1.Length); Buffer.BlockCopy(data2, 0, both, data1.Length, data2.Length); using (Parser parser = new Parser()) { parser.Load("Tests", both); IProperty returnedProp1 = parser.ReadProperty(); Assert.AreEqual("strFirstName", returnedProp1.Name, string.Format("Property Name did not match: Expected: {0}, Actual: {1}", "strFirstName", returnedProp1.Name)); Assert.AreEqual("StrProperty", returnedProp1.TypeName, string.Format("Property Type did not match: Expected: {0}, Actual: {1}", "StrProperty", returnedProp1.TypeName)); Assert.AreEqual("Ana", returnedProp1.Value, string.Format("Property Value did not match: Expected: {0}, Actual: {1}", "Ana", returnedProp1.Value)); IProperty returnedProp2 = parser.ReadProperty(); Assert.AreEqual("strLastName", returnedProp2.Name, string.Format("Property Name did not match: Expected: {0}, Actual: {1}", "strLastName", returnedProp2.Name)); Assert.AreEqual("StrProperty", returnedProp2.TypeName, string.Format("Property Type did not match: Expected: {0}, Actual: {1}", "StrProperty", returnedProp2.TypeName)); Assert.AreEqual("Ramirez", returnedProp2.Value, string.Format("Property Value did not match: Expected: {0}, Actual: {1}", "Ramirez", returnedProp2.Value)); } }
public void TestReadProperty() { byte[] data1 = Combine(_nameData1, _typeData, _sizeData1, _valueData1); using (Parser parser = new Parser()) { parser.Load("Tests", data1); IProperty returnedProp = parser.ReadProperty(); Assert.AreEqual("strFirstName", returnedProp.Name, string.Format("Property Name did not match: Expected: {0}, Actual: {1}", "strFirstName", returnedProp.Name)); Assert.AreEqual("StrProperty", returnedProp.TypeName, string.Format("Property Type did not match: Expected: {0}, Actual: {1}", "StrProperty", returnedProp.TypeName)); Assert.AreEqual("Ana", returnedProp.Value, string.Format("Property Value did not match: Expected: {0}, Actual: {1}", "Ana", returnedProp.Value)); } }