Example #1
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);
        }
Example #2
0
        public void Writes_Bytes()
        {
            var expectedResult = new byte[] {
                0x42, 0x7a, 0xc1, 0x35, 0xff
            };
            var builder = new PduWriter();

            builder.WriteBytes(expectedResult);
            var buffer = builder.GetBytes();

            CollectionAssert.AreEqual(expectedResult, buffer);
        }
Example #3
0
 public void Throws_On_Write_Null_Bytes()
 {
     var builder = new PduWriter();
     Assert.Throws(typeof(ArgumentNullException), () => builder.WriteBytes(null), "Value cannot be null.\r\nParameter name: bytes");
 }
Example #4
0
        public void Resizes_Buffer_On_Write_Bytes()
        {
            var expectedResult = new byte[] {
                0x34, 0x11, 0xcc, 0x7a, 0xef,
            };
            var builder = new PduWriter(0);
            var testValue = new byte[] { 0x34, 0x11, 0xcc, 0x7a, 0xef };
            builder.WriteBytes(testValue);
            var buffer = builder.GetBytes();

            CollectionAssert.AreEqual(expectedResult, buffer);
        }