public void SendWithExclusion()
        {
            var client = TestClient.CreateNaked(session);
            var user   = client.Users[0];

            var inforoomRegion = TestRegion.Find(TestRegion.Inforoom);

            SetUp(
                new List <TestUser> {
                user
            },
                inforoomRegion,
                "Это письмо пользователю",
                "Это текст письма пользователю",
                null);

            var handler = new DocSourceHandlerForTesting(Settings.Default.TestIMAPUser, Settings.Default.TestIMAPPass);

            handler.TestProcessMime(_info.Mime);
            var existsMessages = ImapHelper.CheckImapFolder(Settings.Default.TestIMAPUser, Settings.Default.TestIMAPPass, ImapHelper.INBOXFolder);

            Assert.That(existsMessages.Count, Is.GreaterThanOrEqualTo(1), "Не найдены письма в IMAP-папке");
            var responseCount = existsMessages
                                .Count(m => m.Envelope?.Subject?.Equals(_responseSubject, StringComparison.CurrentCultureIgnoreCase) == true);

            Assert.That(responseCount, Is.EqualTo(1), "Не найдено письмо с загловком '{0}'", _responseSubject);

            var mails = TestMailSendLog.Queryable.Where(l => l.User.Id == user.Id).ToList();

            Assert.That(mails.Count, Is.EqualTo(1));

            var mailLog = mails[0];

            Assert.That(mailLog.Mail.Supplier.Id, Is.EqualTo(_info.Supplier.Id));
        }
Exemplo n.º 2
0
        public void CheckExistsRegion()
        {
            var region    = TestRegion.Find(1ul);
            var recipient = MailRecipient.Parse(region.ShortAliase + "@docs.analit.net");

            Assert.That(recipient, Is.Not.Null);
            Assert.That(recipient.Email, Is.EqualTo(region.ShortAliase + "@docs.analit.net"));
            Assert.That(recipient.Type, Is.EqualTo(RecipientType.Region));
            Assert.That(recipient.Address, Is.Null);
            Assert.That(recipient.Region, Is.Not.Null);
            Assert.That(recipient.Client, Is.Null);
            Assert.That(recipient.Region.Id, Is.EqualTo(region.Id));
            Assert.That(recipient.Status, Is.EqualTo(RecipientStatus.Verified));
        }