Esempio n. 1
0
        public byte[] Serialize(object value, string contentType)
        {
            Check.NotNull(value, nameof(value));
            Check.NotNullOrWhiteSpace(contentType, nameof(contentType));

            IBrokerSerializer serializer = GetSerializer(contentType);

            return(serializer.Serialize(value));
        }
Esempio n. 2
0
            public void SimulateMessageReceived(IMessage message)
            {
                // TEST REFACTOR
                var mockProps = new Mock <IBasicProperties>();

                mockProps.Setup(p => p.ContentType).Returns(_messageSerializer.ContentType);

                var body = _messageSerializer.Serialize(message);

                _messageConsumer.MessageHandlers.First().EventConsumer.HandleBasicDeliver("", 0, false, "", "", mockProps.Object, body);
            }
Esempio n. 3
0
        public byte[] Serialize(IMessage message, params string[] contentTypes)
        {
            Check.NotNull(message, nameof(message));

            string contentType = GetFistContentType(contentTypes);

            message.SetContentType(contentType);

            IBrokerSerializer serializer = GetSerializer(contentType);

            return(serializer.Serialize(message));
        }