public void TestProperties_ReplyTo([Values(null, "foo_1", "fanout://name/key")] string replyTo) { // Arrange var subject = new Framing.BasicProperties { // Act ReplyTo = replyTo, }; // Assert bool isReplyToPresent = replyTo != null; PublicationAddress result; PublicationAddress.TryParse(replyTo, out result); string replyToAddress = result?.ToString(); Assert.AreEqual(isReplyToPresent, subject.IsReplyToPresent()); Span <byte> span = new byte[1024]; var writer = new Impl.ContentHeaderPropertyWriter(span); subject.WritePropertiesTo(ref writer); // Read from Stream var propertiesFromStream = new Framing.BasicProperties(); var reader = new Impl.ContentHeaderPropertyReader(span.Slice(0, writer.Offset)); propertiesFromStream.ReadPropertiesFrom(ref reader); Assert.AreEqual(replyTo, propertiesFromStream.ReplyTo); Assert.AreEqual(isReplyToPresent, propertiesFromStream.IsReplyToPresent()); Assert.AreEqual(replyToAddress, propertiesFromStream.ReplyToAddress?.ToString()); }
public void TestProperties_ReplyTo(string replyTo) { // Arrange var subject = new Framing.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 = subject.WritePropertiesTo(span); // Read from Stream var propertiesFromStream = new Framing.BasicProperties(span.Slice(0, offset)); Assert.Equal(replyTo, propertiesFromStream.ReplyTo); Assert.Equal(isReplyToPresent, propertiesFromStream.IsReplyToPresent()); Assert.Equal(replyToAddress, propertiesFromStream.ReplyToAddress?.ToString()); }