public void All_properties_should_be_preserved() { var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { var testMessage = new TestMessage {TestProperty = "Test"}; formatter.Serialize(stream,testMessage); var original = new TransportMessage { Body = stream.ToArray(), MessageIntent = MessageIntentEnum.Send, CorrelationId = "123", //Id = "11111", Recoverable = true, ReplyToAddress= Address.Parse("response"), TimeToBeReceived = TimeSpan.FromHours(1) }; AddTestMessage(original); var result = receiver.Receive(); var resultMessage = formatter.Deserialize(new MemoryStream(result.Body)) as TestMessage; Assert.AreEqual(resultMessage.TestProperty,"Test"); Assert.AreEqual( result.MessageIntent,original.MessageIntent); Assert.AreEqual(result.CorrelationId,original.CorrelationId); Assert.NotNull(result.Id); Assert.AreEqual(result.Recoverable,original.Recoverable); Assert.AreEqual(result.ReplyToAddress,original.ReplyToAddress); Assert.AreEqual(result.TimeToBeReceived,original.TimeToBeReceived); } }
public void All_properties_should_be_preserved() { var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { var testMessage = new TestMessage { TestProperty = "Test" }; formatter.Serialize(stream, testMessage); var original = new TransportMessage { Body = stream.ToArray(), MessageIntent = MessageIntentEnum.Send, CorrelationId = "123", //Id = "11111", Recoverable = true, ReplyToAddress = Address.Parse("response"), TimeToBeReceived = TimeSpan.FromHours(1) }; AddTestMessage(original); var result = receiver.Receive(); var resultMessage = formatter.Deserialize(new MemoryStream(result.Body)) as TestMessage; Assert.AreEqual(resultMessage.TestProperty, "Test"); Assert.AreEqual(result.MessageIntent, original.MessageIntent); Assert.AreEqual(result.CorrelationId, original.CorrelationId); Assert.NotNull(result.Id); Assert.AreEqual(result.Recoverable, original.Recoverable); Assert.AreEqual(result.ReplyToAddress, original.ReplyToAddress); Assert.AreEqual(result.TimeToBeReceived, original.TimeToBeReceived); } }