Exemple #1
0
 public void NoNotifyIfDeleted()
 {
     ChangeNotificationSender.Sender    = ForTest.CreateStubSender(m => message = m);
     ChangeNotificationSender.UnderTest = true;
     news.Deleted = true;
     Save(news);
     news.Body = "NewTestNewsBody";
     Save(news);
     Close();
     Assert.That(message, Is.Null);
 }
Exemple #2
0
        public void Name_change_one_mail()
        {
            ForTest.InitializeMailer();
            var messages = new List <MailMessage>();

            ChangeNotificationSender.Sender    = ForTest.CreateStubSender(m => messages.Add(m));
            ChangeNotificationSender.UnderTest = true;

            client.Name += "123";
            session.Save(client);
            Flush();

            Assert.That(messages.Count, Is.EqualTo(1));
        }
        public void Notify_about_work_region_mask_changes()
        {
            ForTest.InitializeMailer();
            MailMessage message = null;

            ChangeNotificationSender.Sender    = ForTest.CreateStubSender(m => message = m);
            ChangeNotificationSender.UnderTest = true;

            Reopen();
            user = session.Load <User>(user.Id);
            user.WorkRegionMask = 3;
            Save(user);
            Close();

            Assert.That(message, Is.Not.Null);
            Assert.That(message.Body, Is.StringEnding(String.Format("Код пользователя {0}\r\n"
                                                                    + "Пользователь {1}\r\n"
                                                                    + "Клиент {2}\r\n"
                                                                    + "Изменено 'Регионы работы' Добавлено 'Белгород'\r\n", user.Id, user.Name, client.Name)));
            Assert.That(message.To[0].ToString(), Is.EqualTo("*****@*****.**"));
            Assert.That(message.Subject, Is.EqualTo("Изменено поле 'Регионы работы'"));
        }
Exemple #4
0
        public void Notify_about_news_change_properties()
        {
            ChangeNotificationSender.Sender    = ForTest.CreateStubSender(m => message = m);
            ChangeNotificationSender.UnderTest = true;

            Reopen();
            news      = session.Load <News>(news.Id);
            news.Body = "NewTestNewsBody";
            Save(news);
            Close();
            Assert.That(message, Is.Not.Null);
            Assert.That(message.Body, Is.StringEnding(String.Format(@"Дата изменения: {1}<br>
Сотрудник: test<br>
Хост: localhost<br>
Код новости: {0}<br>
Новость: <a href=""/News/{0}"">TestNewHeader</a><br>
Адресат: {2}<br>
Дата и время публикации новости: {3}<br>
Изменено 'Тело новости' </br> <b>было</b> 'TestNewsBody'</br><b>стало</b> 'NewTestNewsBody'
", news.Id, DateTime.Now, news.DestinationType.GetDescription(), news.PublicationDate)));
            Assert.That(message.To[0].ToString(), Is.EqualTo("*****@*****.**"));
            Assert.That(message.Subject, Is.EqualTo("Изменено поле 'Тело новости'"));
        }