예제 #1
0
        public void SerializeBatch_EmptyCollectionOfMessages_ReturnEmptyCollection()
        {
            // arrange
            var serializer = new MessageSerializer();

            // act
            var actualMessages = serializer.SerializeBatch(new List <FakeMessage>());

            // assert
            Assert.Empty(actualMessages);
        }
예제 #2
0
        public void SerializeBatch_Message_ReturnConfiguratedMessage()
        {
            // arrange
            var serializer = new MessageSerializer();
            var messages   = new List <FakeMessage> {
                new FakeMessage(1), new FakeMessage(1)
            };

            // act
            var actualMessages = serializer.SerializeBatch(messages);

            // assert
            for (int i = 0; i < actualMessages.Count; i++)
            {
                var message    = actualMessages[i];
                var expMessage = messages[i];
                Assert.Equal(
                    message.UserProperties[CustomMessageProperties.MessageTypeProperty],
                    expMessage.GetType().FullName);
                Assert.NotNull(message.Body);
            }
        }