Beispiel #1
0
        private void CheckSendAndReceive(As4Message expectedRequest)
        {
            Action <As4Message> handler = actualMessage =>
            {
                MessageAssert.AreEqual(expectedRequest, actualMessage);
            };

            using (Servers.Create(Url, handler))
            {
                var client = new As4Client();
                var result = client.Send(new Uri(Url), expectedRequest);
                Assert.IsNull(result);
            }
        }
        private void CheckSerialization(Envelope envelope, params Attachment[] attachments)
        {
            var message     = Messages.Create(envelope, attachments);
            var mimeEntity  = As4MessageToMimeEntity.Serialize(message);
            var contentType = mimeEntity.ContentType;
            var stream      = new MemoryStream();

            mimeEntity.WriteTo(stream, true);
            stream.Position = 0;
            var decodedEntity  = MimeEntity.Load(contentType, stream);
            var decodedMessage = MimeEntityToAs4Message.Deserialize(decodedEntity);

            MessageAssert.AreEqual(message, decodedMessage);
        }
Beispiel #3
0
        private void CheckSendAndReceive(As4Message expectedRequest, As4Message expectedResponse)
        {
            Func <As4Message, As4Message> handler = actualRequest =>
            {
                MessageAssert.AreEqual(expectedRequest, actualRequest);
                return(expectedResponse);
            };

            using (Servers.Create(Url, handler))
            {
                var client         = new As4Client();
                var actualResponse = client.Send(new Uri(Url), expectedRequest);
                MessageAssert.AreEqual(expectedResponse, actualResponse);
            }
        }