public async Task Serialize_serializes_message_correctly()
        {
            var message  = fixture.Create <BlogPostCreated>();
            var envelope = new Envelope(message);

            BrokeredMessage brokeredMessage = await sut.Serialize(envelope);

            using (var stream = brokeredMessage.GetBody <Stream>())
                using (var reader = new StreamReader(stream, Encoding.UTF8))
                {
                    string value  = reader.ReadToEnd();
                    object actual = messageSerializer.Deserialize(value);
                    actual.Should().BeOfType <BlogPostCreated>();
                    actual.ShouldBeEquivalentTo(message);
                }
        }
Exemple #2
0
        private async Task SendMessage(Envelope envelope)
        {
            BrokeredMessage brokeredMessage = await _serializer.Serialize(envelope).ConfigureAwait(false);

            await _queueClient.SendAsync(brokeredMessage).ConfigureAwait(false);
        }