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)); }
public void TestPofStreamWriteWriteCollection() { initPOFWriter(); var col1 = new ArrayList(); var col2 = new ArrayList(); col1.Add("A"); col1.Add("Z"); col1.Add("7"); col2.Add(32); col2.Add(Int32.MinValue); col2.Add(Int32.MaxValue); pofwriter.WriteCollection(0, null); pofwriter.WriteCollection(0, col1); pofwriter.WriteCollection(0, col2); pofwriter.WriteCollection(0, col1); pofwriter.WriteDate(0, new DateTime(2006, 8, 8)); initPOFReader(); Assert.AreEqual(null, pofreader.ReadCollection(0, null)); Assert.AreEqual(col1.ToArray(), ((ArrayList)pofreader.ReadCollection(0, new ArrayList(3))).ToArray()); Assert.AreEqual(col2.ToArray(), ((ArrayList)pofreader.ReadCollection(0, new ArrayList(3))).ToArray()); Assert.AreEqual(col1.ToArray(), pofreader.ReadCollection(0, null)); Assert.AreEqual(col1.ToArray(), pofreader.ReadCollection(0, null)); // exception }