public void Change_Name_Full_Name() { var oldValue = client.Name; client.Name += "1"; var property = new AuditableProperty(session, payer.GetType().GetProperty("Name"), "Наименование", client.Name, oldValue); mailer.NotifyAboutChanges(property, client, "*****@*****.**"); Assert.That(message.IsBodyHtml, Is.False); Assert.That(message.Subject, Is.EqualTo("Изменено поле 'Наименование'")); Assert.That(message.To.ToString(), Is.EqualTo("*****@*****.**")); Assert.That(message.Body, Is.StringContaining("Плательщики Тестовый плательщик")); Assert.That(message.Body, Is.StringContaining("Изменено 'Наименование' было 'Тестовый клиент' стало 'Тестовый клиент1'")); Assert.That(message.Body, Is.StringContaining(DateTime.Now.Date.ToShortDateString())); }
public virtual void CheckCommentChangesAndLog(ISession session, MonorailMailer mailer) { if (!this.IsChanged(p => p.Comment)) { return; } var oldValue = this.OldValue(p => p.Comment); var propertyInfo = typeof(Payer).GetProperty("Comment"); var property = new DiffAuditableProperty(session, propertyInfo, BindingHelper.GetDescription(propertyInfo), Comment, oldValue); mailer.NotifyAboutChanges(property, this, "*****@*****.**"); foreach (var client in Clients) { var log = new AuditRecord(client) { Message = property.Message, IsHtml = property.IsHtml, MessageType = LogMessageType.Stat }; log.Save(); } }