public void TestPofStreamReaderReadObjectYearMonthInterval()
        {
            initPOFWriter();
            pofwriter.WriteRawYearMonthInterval(0, new RawYearMonthInterval(1, 1));

            initPOFReader();
            Assert.AreEqual(new RawYearMonthInterval(1, 1), pofreader.ReadObject(0));
        }
Example #2
0
        public void TestSkipUniformValue()
        {   //PASSED
            // PLEASE DO NOTE, the method SkipUniformValue should be used only for Uniform_Arrays/Collections
            initPOFWriter();

            pofwriter.WriteInt32(0, 100);
            pofwriter.WriteInt32(0, 200);
            pofwriter.WriteInt32(0, 300);

            initPOFReader();
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            Assert.AreEqual(PofConstants.T_INT32, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32));
            Assert.AreEqual(300, PofHelper.ReadAsInt32(reader, PofConstants.T_INT32));

            initPOFWriter();
            RawYearMonthInterval ymi = new RawYearMonthInterval(2, 10);

            pofwriter.WriteRawYearMonthInterval(0, ymi);
            pofwriter.WriteString(0, "skipping to string1");
            pofwriter.WriteTimeInterval(0, new TimeSpan(4, 52, 10));
            pofwriter.WriteString(0, "skipping to string2");
            pofwriter.WriteDayTimeInterval(0, new TimeSpan(11, 12, 13, 14, 50));
            pofwriter.WriteString(0, "skipping to string3");
            pofwriter.WriteSingle(0, 120.34f);
            pofwriter.WriteString(0, "skipping to string4");
            pofwriter.WriteDouble(0, 1222.22);
            pofwriter.WriteString(0, "skipping to string5");
            pofwriter.WriteChar(0, 'A');
            pofwriter.WriteString(0, "skipping to string6");

            initPOFReader();
            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_YEAR_MONTH_INTERVAL);
            Assert.AreEqual("skipping to string1", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_TIME_INTERVAL);
            Assert.AreEqual("skipping to string2", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_DAY_TIME_INTERVAL);
            Assert.AreEqual("skipping to string3", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_FLOAT32);
            Assert.AreEqual("skipping to string4", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_FLOAT64);
            Assert.AreEqual("skipping to string5", pofreader.ReadString(0));

            PofHelper.SkipUniformValue(reader, PofConstants.T_INT32);
            PofHelper.SkipUniformValue(reader, PofConstants.T_CHAR);
            Assert.AreEqual("skipping to string6", pofreader.ReadString(0));
        }