public void ByteArrayConversion()
        {
            BytesMessage message = new BytesMessage(tibcoSession);
            ASCIIEncoding encoding = new ASCIIEncoding();
            byte[] content =  encoding.GetBytes("test");

            Expect.Call(session.CreateBytesMessage()).Return(message);
            

            mocks.ReplayAll();

            Message msg = converter.ToMessage(content, session);
            message.Reset();
            Assert.AreEqual(content.Length, ((byte[])converter.FromMessage(msg)).Length);

            mocks.VerifyAll();
        }
Ejemplo n.º 2
0
 /// <summary> Extract a byte array from the given BytesMessage.</summary>
 /// <param name="message">the message to convert
 /// </param>
 /// <returns> the resulting byte array
 /// </returns>
 /// <throws>  EMSException if thrown by EMS methods </throws>
 protected virtual byte[] ExtractByteArrayFromMessage(BytesMessage message)
 {
     byte[] bytes = new byte[(int)message.BodyLength];
     message.ReadBytes(bytes);
     return bytes;
 }