Example #1
0
        public void TestDispatchedNotificationMessage()
        {
            Message source = this.CreateSourceMessage();

            Notification        notification        = this.CreateDispatchedNotification();
            NotificationMessage notificationMessage = source.CreateNotificationMessage(new MailAddress(source.FromValue), notification);

            Assert.True(notificationMessage.IsMDN());
            Assert.False(notificationMessage.ShouldIssueNotification());

            Assert.True(notificationMessage.IsMultiPart);
            Assert.True(notificationMessage.ToValue == source.Headers.GetValue(MDNStandard.Headers.DispositionNotificationTo));

            Assert.True(!string.IsNullOrEmpty(notificationMessage.SubjectValue));

            Assert.True(notificationMessage.HasHeader(MimeStandard.VersionHeader));
            Assert.True(notificationMessage.HasHeader(MailStandard.Headers.Date));

            MimeEntity[] mdnEntities = notificationMessage.GetParts().ToArray();
            this.Verify(mdnEntities);

            this.VerifyDispositionTypeNotification(mdnEntities[1], notification);

            HeaderCollection fields = this.GetNotificationFields(mdnEntities[1]);

            Assert.NotNull(fields[MDNStandard.Fields.FinalRecipient]);
        }