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); }
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); }
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); }
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); }
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); }
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); }
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); }