Ejemplo n.º 1
0
        public void Appends_Four_Byte_Integer()
        {
            var expectedResult = new byte[] {
                0x00, 0x00, 0xfe, 0xf7,
                0x00, 0x01, 0x36, 0x16
            };
            var builder = new PduWriter();

            builder.WriteInteger(65271);
            builder.WriteInteger(79382);
            var buffer = builder.GetBytes();

            CollectionAssert.AreEqual(expectedResult, buffer);
        }
Ejemplo n.º 2
0
        public void Appends_String()
        {
            var expectedResult = new byte[] {
                0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x00,
                0x00, 0x01, 0x36, 0x16
            };
            var builder = new PduWriter();

            builder.WriteString("Hello");
            builder.WriteInteger(79382);
            var buffer = builder.GetBytes();

            CollectionAssert.AreEqual(expectedResult, buffer);
        }
Ejemplo n.º 3
0
        public void Appends_Single_Byte_Integer()
        {
            var expectedResult = new byte[] {
                0x24,
                0x00, 0x01, 0x36, 0x16
            };
            var builder = new PduWriter();

            byte testValue = 0x24;
            builder.WriteByte(testValue);
            builder.WriteInteger(79382);
            var buffer = builder.GetBytes();

            CollectionAssert.AreEqual(expectedResult, buffer);
        }
Ejemplo n.º 4
0
        public void Appends_Bytes()
        {
            var expectedResult = new byte[] {
                0x34, 0x11, 0xcc, 0x7a, 0xef,
                0x00, 0x01, 0x36, 0x16
            };
            var builder = new PduWriter();

            var testValue = new byte[] { 0x34, 0x11, 0xcc, 0x7a, 0xef };
            builder.WriteBytes(testValue);
            builder.WriteInteger(79382);
            var buffer = builder.GetBytes();

            CollectionAssert.AreEqual(expectedResult, buffer);
        }
Ejemplo n.º 5
0
        public void Appends_Two_Byte_Integer()
        {
            var expectedResult = new byte[] {
                0x07, 0x28,
                0x00, 0x01, 0x36, 0x16
            };
            var builder = new PduWriter();

            short testValue = 1832;
            builder.WriteShort(testValue);
            builder.WriteInteger(79382);
            var buffer = builder.GetBytes();

            CollectionAssert.AreEqual(expectedResult, buffer);
        }
Ejemplo n.º 6
0
        public void Writes_Four_Byte_Integer()
        {
            var expectedResult = new byte[] {
                0x49, 0x63, 0x18, 0xff
            };
            var builder = new PduWriter();

            builder.WriteInteger(1231231231);
            var buffer = builder.GetBytes();

            CollectionAssert.AreEqual(expectedResult, buffer);
        }
Ejemplo n.º 7
0
        public void Resizes_Buffer_On_Write_Four_Byte_Integer()
        {
            var expectedResult = new byte[] {
                0x00, 0x01, 0x36, 0x16
            };
            var builder = new PduWriter(0);
            builder.WriteInteger(79382);
            var buffer = builder.GetBytes();

            CollectionAssert.AreEqual(expectedResult, buffer);
        }