public void TestPofStreamWriteByte() { initPOFWriter(); pofwriter.WriteByte(0, 1); pofwriter.WriteByte(0, 2); pofwriter.WriteByte(0, 255); pofwriter.WriteByte(0, 0); initPOFReader(); Assert.AreEqual(1, pofreader.ReadByte(0)); Assert.AreEqual(2, pofreader.ReadByte(0)); Assert.AreEqual(255, pofreader.ReadByte(0)); Assert.AreEqual(0, pofreader.ReadByte(0)); }
/*---------Utility methods for writing POF data----------------------*/ private void writeByte() { DataWriter dw = initPofWriter("Byte"); WritingPofHandler wfh = new WritingPofHandler(dw); PofStreamWriter psw = new PofStreamWriter(wfh, new SimplePofContext()); psw.WriteByte(0, 1); psw.WriteByte(0, 0); psw.WriteByte(0, 200); psw.WriteByte(0, 255); dw.Flush(); dw.Close(); }
public void TestSkipValue() { //PASSED initPOFWriter(); pofwriter.WriteDate(0, new DateTime(2006, 8, 10, 12, 59, 11)); pofwriter.WriteDateTime(0, new DateTime(2006, 8, 10, 12, 59, 11)); pofwriter.WriteUniversalDateTime(0, new DateTime(2006, 8, 10, 12, 59, 11, 1)); pofwriter.WriteCharArray(0, new char[] { 'g', 't', 's' }); pofwriter.WriteArray(0, new object[] { 'g', "Gor", 55 }); pofwriter.WriteArray(0, new object[] { new int[] { 1, 2 }, new int[] { 3, 2, 4 } }); Hashtable ht = new Hashtable(); ht.Add(1, "t"); ht.Add(2, "g"); pofwriter.WriteObject(0, ht); pofwriter.WriteByte(0, 0x00F0); pofwriter.WriteInt32(0, 300); initPOFReader(); PofHelper.SkipValue(reader); PofHelper.SkipValue(reader); PofHelper.SkipValue(reader); PofHelper.SkipValue(reader); PofHelper.SkipValue(reader); PofHelper.SkipValue(reader); PofHelper.SkipValue(reader); PofHelper.SkipValue(reader); Assert.AreEqual(PofConstants.T_INT32, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32)); Assert.AreEqual(300, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32)); }