public void TestProperties_ReplyTo(string replyTo) { // Arrange var subject = new BasicProperties { // Act ReplyTo = replyTo, }; // Assert bool isReplyToPresent = replyTo != null; PublicationAddress.TryParse(replyTo, out PublicationAddress result); string replyToAddress = result?.ToString(); Assert.Equal(isReplyToPresent, subject.IsReplyToPresent()); Span <byte> span = new byte[1024]; int offset = ((IAmqpWriteable)subject).WriteTo(span); // Read from Stream var propertiesFromStream = new ReadOnlyBasicProperties(span.Slice(0, offset)); Assert.Equal(replyTo, propertiesFromStream.ReplyTo); Assert.Equal(isReplyToPresent, propertiesFromStream.IsReplyToPresent()); Assert.Equal(replyToAddress, propertiesFromStream.ReplyToAddress?.ToString()); // Verify Basic Properties var basicProperties = new BasicProperties(propertiesFromStream); Assert.Equal(replyTo, basicProperties.ReplyTo); Assert.Equal(isReplyToPresent, basicProperties.IsReplyToPresent()); Assert.Equal(replyToAddress, basicProperties.ReplyToAddress?.ToString()); }
public void Should_copy_to_rabbit_client_properties() { const string replyTo = "reply to"; var properties = new MessageProperties { ReplyTo = replyTo }; var destinationProperties = new BasicProperties(); properties.CopyTo(destinationProperties); destinationProperties.ReplyTo.ShouldEqual(replyTo); destinationProperties.IsReplyToPresent().ShouldBeTrue(); destinationProperties.IsMessageIdPresent().ShouldBeFalse(); }
private void TestBasicPropertiesNoneClone(BasicProperties bp) { // Do not set any member and clone BasicProperties bpClone = bp.Clone() as BasicProperties; // Set members in source object bp.ContentType = "foo_1"; bp.ContentEncoding = "foo_2"; bp.Headers = new Dictionary <string, object> { { "foo_3", "foo_4" }, { "foo_5", "foo_6" } }; bp.DeliveryMode = 2; // Persistent also changes DeliveryMode's value to 2 bp.Persistent = true; bp.Priority = 12; bp.CorrelationId = "foo_7"; bp.ReplyTo = "foo_8"; bp.Expiration = "foo_9"; bp.MessageId = "foo_10"; bp.Timestamp = new AmqpTimestamp(123); bp.Type = "foo_11"; bp.UserId = "foo_12"; bp.AppId = "foo_13"; bp.ClusterId = "foo_14"; // Check that no member is present in clone Assert.AreEqual(false, bpClone.IsContentTypePresent()); Assert.AreEqual(false, bpClone.IsContentEncodingPresent()); Assert.AreEqual(false, bpClone.IsHeadersPresent()); Assert.AreEqual(false, bpClone.IsDeliveryModePresent()); Assert.AreEqual(false, bpClone.IsPriorityPresent()); Assert.AreEqual(false, bpClone.IsCorrelationIdPresent()); Assert.AreEqual(false, bpClone.IsReplyToPresent()); Assert.AreEqual(false, bpClone.IsExpirationPresent()); Assert.AreEqual(false, bpClone.IsMessageIdPresent()); Assert.AreEqual(false, bpClone.IsTimestampPresent()); Assert.AreEqual(false, bpClone.IsTypePresent()); Assert.AreEqual(false, bpClone.IsUserIdPresent()); Assert.AreEqual(false, bpClone.IsAppIdPresent()); Assert.AreEqual(false, bpClone.IsClusterIdPresent()); }