public byte[] Serialize(IList<HeaderInfo> headers) { if (CurrentSagaIds.OutgoingIds != null && CurrentSagaIds.OutgoingIds.Length > 0) { var value = String.Join(",", CurrentSagaIds.OutgoingIds.Select(x => x.ToString()).ToArray()); var header = new HeaderInfo() { Key = "machine.sagas", Value = value }; _log.Debug("Serializing: " + value); return _serializer.Serialize(headers.Union(new[] { header }).ToList()); } return _serializer.Serialize(headers); }
public void ShouldPreservesCustomMessageHeaders() { var header1 = new HeaderInfo {Key = "foo", Value = "foo-value"}; var header2 = new HeaderInfo {Key = "bar", Value = "bar-value"}; sent.Headers = new List<HeaderInfo> {header1, header2}; SendAndReceive(); Assert.That(received.Headers.Count, Is.EqualTo(2)); Assert.That(received.Headers[0].Key, Is.EqualTo("foo")); Assert.That(received.Headers[0].Value, Is.EqualTo("foo-value")); Assert.That(received.Headers[1].Key, Is.EqualTo("bar")); Assert.That(received.Headers[1].Value, Is.EqualTo("bar-value")); }