public void Body_is_mapped_from_metadata_of_last_processing_attempt()
        {
            var failedMessage = new FailedMessageBuilder(FailedMessageStatus.Unresolved)
                                .AddProcessingAttempt(pa => { pa.MessageMetadata["Body"] = "Beautiful Body"; })
                                .Build();

            var result = failedMessage.ToEvent();

            Assert.AreEqual("Beautiful Body", result.MessageDetails.Body);
        }
        public void Unresolved_failure_is_not_considered_repeated_if_it_has_only_one_processing_attempt()
        {
            var failedMessage = new FailedMessageBuilder(FailedMessageStatus.Unresolved)
                                .AddProcessingAttempt(pa => { })
                                .Build();

            var result = failedMessage.ToEvent();

            Assert.AreEqual(MessageFailed.MessageStatus.Failed, result.Status);
        }
        public void If_not_present_in_metadata_body_is_ignored()
        {
            var failedMessage = new FailedMessageBuilder(FailedMessageStatus.Unresolved)
                                .AddProcessingAttempt(pa => { })
                                .Build();

            var result = failedMessage.ToEvent();

            Assert.IsNull(result.MessageDetails.Body);
        }
        public void Archive_status_maps_to_archive()
        {
            var failedMessage = new FailedMessageBuilder(FailedMessageStatus.Archived)
                                .AddProcessingAttempt(pa => { })
                                .Build();

            var result = failedMessage.ToEvent();

            Assert.AreEqual(MessageFailed.MessageStatus.ArchivedFailure, result.Status);
        }
        public void If_content_type_is_missing_it_is_ignored()
        {
            var failedMessage = new FailedMessageBuilder(FailedMessageStatus.Unresolved)
                                .SetContentType(null)
                                .AddProcessingAttempt(pa => { })
                                .Build();

            var result = failedMessage.ToEvent();

            Assert.IsNull(result.MessageDetails.ContentType);
        }