/// <summary> /// 转换为消息模板实体 /// </summary> /// <param name="dto">消息模板数据传输对象</param> public static MessageTemplate ToEntity3(this MessageTemplateDto dto) { if (dto == null) { return(new MessageTemplate()); } return(MessageTemplateFactory.Create( templateId: dto.Id.ToGuid(), categoryId: dto.CategoryId, type: dto.Type, sendObject: dto.SendObject, name: dto.Name, sourceId: dto.SourceId, title: dto.Title, content: dto.Content, isEnabled: dto.IsEnabled, sortId: dto.SortId, creationTime: dto.CreationTime, creatorId: dto.CreatorId, lastModifierId: dto.LastModifierId, lastModificationTime: dto.LastModificationTime, isDeleted: dto.IsDeleted, version: dto.Version )); }
public void MessageTemplateFactory_CreatesEmailTemplate() { EmailTemplate expected = new EmailTemplate(); expected.Subject = "subject test"; expected.BodyHtml = "html body test"; expected.BodyText = "text body test"; MessageTemplateFactory <EmailTemplate> templateFactory = new MessageTemplateFactory <EmailTemplate>(); EmailTemplate actual = templateFactory.Create(EmailTemplates.ResourceManager, "Test"); actual.ShouldBeEquivalentTo(expected); }