Beispiel #1
0
        private void writeInt16()
        {
            DataWriter        dw  = initPofWriter("Int16");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteInt16(0, (Int16)(-1));
            psw.WriteInt16(0, (Int16)0);
            psw.WriteInt16(0, Int16.MaxValue);

            dw.Flush();
            dw.Close();
        }
        public void TestPofStreamWriteInt16()
        {
            initPOFWriter();
            pofwriter.WriteInt16(0, 0);
            pofwriter.WriteInt16(0, -1);
            pofwriter.WriteInt16(0, Int16.MaxValue);
            pofwriter.WriteInt16(0, 101);
            pofwriter.WriteInt16(0, Int16.MinValue);

            initPOFReader();
            Assert.AreEqual(0, pofreader.ReadInt16(0));
            Assert.AreEqual(-1, pofreader.ReadInt16(0));
            Assert.AreEqual(Int16.MaxValue, pofreader.ReadInt16(0));
            Assert.AreEqual(101, pofreader.ReadInt16(0));
            Assert.AreEqual(Int16.MinValue, pofreader.ReadInt16(0));
        }