public void TestSimpleProperties() { IAmqpWriteable prop = new BasicProperties { ContentType = "text/plain" }; int bytesNeeded = prop.GetRequiredBufferSize(); byte[] bytes = new byte[bytesNeeded]; int offset = prop.WriteTo(bytes); Check(bytes.AsMemory().Slice(0, offset), new byte[] { 0x80, 0x00, // props flags 0x0A, // shortstr len 0x74, 0x65, 0x78, 0x74, 0x2F, 0x70, 0x6C, 0x61, 0x69, 0x6E // text/plain }); }
public void TestFullProperties() { IAmqpWriteable prop = new BasicProperties { AppId = "A", ContentType = "B", ContentEncoding = "C", ClusterId = "D", CorrelationId = "E", DeliveryMode = DeliveryModes.Transient, Expiration = "F", MessageId = "G", Priority = 2, Timestamp = new AmqpTimestamp(3), Type = "H", ReplyTo = "I", UserId = "J", Headers = new Dictionary <string, object>(0) }; int bytesNeeded = prop.GetRequiredBufferSize(); byte[] bytes = new byte[bytesNeeded]; int offset = prop.WriteTo(bytes); Check(bytes.AsMemory().Slice(0, offset), new byte[] { 0b1111_1111, 0b1111_1100, // props flags (all set) 0x01, 0x42, // ContentType 0x01, 0x43, // ContentEncoding 0x00, 0x00, 0x00, 0x00, // Headers (length 0) 0x01, // DeliveryMode 0x02, // Priority 0x01, 0x45, // CorrelationId 0x01, 0x49, // ReplyTo 0x01, 0x46, // Expiration 0x01, 0x47, // MessageId 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, // Timestamp 0x01, 0x48, // Type 0x01, 0x4A, // UserId 0x01, 0x41, // AppId 0x01, 0x44, // ClusterId });