Example #1
0
        public void ReadNullableGuid_Random()
        {
            var value   = Guid.NewGuid();
            var encoder = new ClassicDecoder(new Buffer <Byte>(new Byte[] { 17, 0, 1 }.Concat(value.ToByteArray()).ToArray()));

            Assert.AreEqual(value, encoder.ReadNullableGuid());
        }
Example #2
0
        public void ReadNullableIPAddress_Test()
        {
            var encoder = new ClassicDecoder(StringToBuffer("05-00-04-01-02-03-04"));

            Assert.AreEqual("1.2.3.4", encoder.ReadNullableIPAddress().ToString());
        }
Example #3
0
        public void ReadNullableDateTimeSimple_Nullable()
        {
            var encoder = new ClassicDecoder(StringToBuffer("01-00-00"));

            Assert.AreEqual(null, encoder.ReadNullableDateTimeSimple());
        }
Example #4
0
        public void ReadNullableDateTimeSimple_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("09-00-01-01-00-00-00-00-00-00-00"));

            Assert.AreEqual(DateUtility.Epoch.AddSeconds(1), encoder.ReadNullableDateTimeSimple());
        }
Example #5
0
        public void ReadNullableDateTime_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("09-00-01-01-00-00-00-00-00-00-00"));

            Assert.AreEqual(new DateTime(1), encoder.ReadNullableDateTime());
        }
Example #6
0
        public void ReadNullableUInt32_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("05-00-01-01-00-00-00"));

            Assert.AreEqual((UInt32)1, encoder.ReadNullableUInt32());
        }
Example #7
0
        public void ReadNullableUInt16_Null()
        {
            var encoder = new ClassicDecoder(StringToBuffer("01-00-00"));

            Assert.AreEqual(null, encoder.ReadNullableUInt16());
        }
Example #8
0
        public void ReadSInt8_Minus1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("01-00-FF"));

            Assert.AreEqual(-1, encoder.ReadSInt8());
        }
Example #9
0
        public void ReadBoolean_False()
        {
            var encoder = new ClassicDecoder(StringToBuffer("01-00-00"));

            Assert.AreEqual(false, encoder.ReadBoolean());
        }
Example #10
0
        public void ReadBoolean_True()
        {
            var encoder = new ClassicDecoder(StringToBuffer("01-00-FF"));

            Assert.AreEqual(true, encoder.ReadBoolean());
        }
Example #11
0
        public void ReadNullableDouble_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("09-00-01-00-00-00-00-00-00-F0-3F"));

            Assert.AreEqual(1, encoder.ReadNullableDouble());
        }
Example #12
0
        public void ReadNullableFloat_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("05-00-01-00-00-80-3F"));

            Assert.AreEqual(1, encoder.ReadNullableFloat());
        }
Example #13
0
        public void ReadNullableSInt64_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("09-00-01-01-00-00-00-00-00-00-00"));

            Assert.AreEqual(1, encoder.ReadNullableSInt64());
        }
Example #14
0
        public void ReadUInt8_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("01-00-01"));

            Assert.AreEqual(1, encoder.ReadUInt8());
        }
Example #15
0
        public void ReadUInt64_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("08-00-01-00-00-00-00-00-00-00"));

            Assert.AreEqual((UInt64)1, encoder.ReadUInt64());
        }
Example #16
0
        public void ReadNullableString_Test()
        {
            var encoder = new ClassicDecoder(StringToBuffer("07-00-01-04-00-74-65-73-74"));

            Assert.AreEqual("test", encoder.ReadNullableString());
        }
Example #17
0
        public void Read_Raw()
        {
            var encoder = new ClassicDecoder(StringToBuffer("03-00-01-02-03"));

            Assert.AreEqual("01-02-03", BitConverter.ToString(encoder.Read(3)));
        }
Example #18
0
        public void ReadTime_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("08-00-01-00-00-00-00-00-00-00"));

            Assert.AreEqual(new TimeSpan(1), encoder.ReadTime());
        }
Example #19
0
        public void ReadNullableSInt8_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("02-00-01-01"));

            Assert.AreEqual((SByte)1, encoder.ReadNullableSInt8());
        }
Example #20
0
        public void ReadNullableTimeSimple_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("09-00-01-01-00-00-00-00-00-00-00"));

            Assert.AreEqual(new TimeSpan(0, 0, 1), encoder.ReadNullableTimeSimple());
        }
Example #21
0
        public void ReadSInt16_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("02-00-01-00"));

            Assert.AreEqual(1, encoder.ReadSInt16());
        }
Example #22
0
        public void ReadNullableSInt16_1()
        {
            var encoder = new ClassicDecoder(StringToBuffer("03-00-01-01-00"));

            Assert.AreEqual((Int16)1, encoder.ReadNullableSInt16());
        }