public void ObjectHeaderTests() { Message message = Message.CreateMessage(MessageVersion.Soap12WSAddressing10, "http://www.action.com/"); GeneratedSerializableObject generatedSerializableObject = new GeneratedSerializableObject(2, 200L); MessageHeader header = MessageHeader.CreateHeader("foo", "", generatedSerializableObject); message.Headers.Add(header); Message message2 = MessageTestUtilities.SendAndReceiveMessage(message); int num = message2.Headers.FindHeader("foo", ""); Assert.NotEqual(-1, num); object header2 = message2.Headers.GetHeader <GeneratedSerializableObject>(num); object header3 = message2.Headers.GetHeader <GeneratedSerializableObject>("foo", ""); Assert.False(!generatedSerializableObject.Equals(header2) || !generatedSerializableObject.Equals(header3)); string s = "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:a=\"http://schemas.xmlsoap.org/ws/2003/03/addressing\"><s:Header /><s:Body /></s:Envelope>"; message = Message.CreateMessage(new XmlTextReader(new StringReader(s)), 2147483647, MessageVersion.Default); message2 = Message.CreateMessage(new XmlTextReader(new StringReader(s)), 2147483647, MessageVersion.Default); Message two = MessageTestUtilities.SendAndReceiveMessage(message); Assert.True(MessageTestUtilities.AreBodiesEqual(message2, two)); }
public void BodyWriterMessageTest() { string action = "http://www.action.com/"; Message m1 = Message.CreateMessage(MessageVersion.Soap12WSAddressing10, action, new CustomGeneratedBodyWriter(2, 1024)); Message m1p = Message.CreateMessage(MessageVersion.Soap12WSAddressing10, action, new CustomGeneratedBodyWriter(2, 1024)); // Note, m1 is closed by this, which is we compare m2 with m1p Message m2 = MessageTestUtilities.SendAndReceiveMessage(m1); Assert.True(MessageTestUtilities.AreBodiesEqual(m1p, m2, true, true)); }