public void The_encrypted_serializer_should_be_awesome()
        {
            byte[] serializedMessageData;
            string key = "eguhidbehumjdemy1234567890123456";

            var serializer = new PreSharedKeyEncryptedMessageSerializer(key);

            using (var output = new MemoryStream())
            {
                serializer.Serialize(output, _message);

                serializedMessageData = output.ToArray();

                Trace.WriteLine(Encoding.UTF8.GetString(serializedMessageData));
            }

            var deserializer = new PreSharedKeyEncryptedMessageSerializer(key);

            using (var input = new MemoryStream(serializedMessageData))
            {
                var receivedMessage = deserializer.Deserialize(input) as SerializationTestMessage;

                Assert.AreEqual(_message, receivedMessage);
            }
        }
        public void The_encrypted_serializer_should_be_awesome()
        {
            byte[] serializedMessageData;

            var serializer = new PreSharedKeyEncryptedMessageSerializer(_key, new TSerializer());

            using (var output = new MemoryStream())
            {
                serializer.Serialize(output, _message.ToSendContext());

                serializedMessageData = output.ToArray();

                //          Trace.WriteLine(Encoding.UTF8.GetString(serializedMessageData));
            }

            using (var input = new MemoryStream(serializedMessageData))
            {
                ReceiveContext receiveContext = ReceiveContext.FromBodyStream(input);
                serializer.Deserialize(receiveContext);

                IConsumeContext <PartialSerializationTestMessage> context;
                receiveContext.TryGetContext(out context).ShouldBeTrue();

                context.ShouldNotBeNull();

                context.Message.ShouldEqual(_message);
            }
        }
        public void The_encrypted_serializer_should_be_awesome()
        {
            byte[] serializedMessageData;
            string key = "eguhidbehumjdemy1234567890123456";

            var serializer = new PreSharedKeyEncryptedMessageSerializer(key);

            using (var output = new MemoryStream())
            {
                serializer.Serialize(output, _message);

                serializedMessageData = output.ToArray();

                Trace.WriteLine(Encoding.UTF8.GetString(serializedMessageData));
            }

            var deserializer = new PreSharedKeyEncryptedMessageSerializer(key);

            using (var input = new MemoryStream(serializedMessageData))
            {
                var receivedMessage = deserializer.Deserialize(input) as SerializationTestMessage;

                Assert.AreEqual(_message, receivedMessage);
            }
        }