FillTemplate-Methode als Erweiterung hinzugefügt. Option zum Schreiben von Platzhaltern als Wörterbuch hinzugefügt.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using DigitalData.EmailProfilerDispatcher.Application;
|
||||
using DigitalData.EmailProfilerDispatcher.Application.Services;
|
||||
using DigitalData.EmailProfilerDispatcher.Domain.Attributes;
|
||||
using DigitalData.EmailProfilerDispatcher.Domain.Entities;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace EmailProfilerDispatcher.Tests
|
||||
{
|
||||
@@ -27,7 +29,8 @@ namespace EmailProfilerDispatcher.Tests
|
||||
|
||||
var mailData1 = new MailData1();
|
||||
var mailData2 = new MailData2();
|
||||
var mailData3 = new MailData3();
|
||||
Dictionary<string, string> placeholders = new();
|
||||
placeholders.Add(@"[NAME_PORTAL]", "DokumentenPortal");
|
||||
|
||||
var expectedOutput = @"Guten Tag Tom,<br />
|
||||
<br />
|
||||
@@ -39,7 +42,9 @@ namespace EmailProfilerDispatcher.Tests
|
||||
DokumentenPortal";
|
||||
|
||||
// Act
|
||||
var result = EmailOutService<Resource>.FillTemplate(template, mailData1, mailData2, mailData3);
|
||||
var result = template
|
||||
.FillTemplate(placeholders)
|
||||
.FillTemplate(template, mailData1, mailData2);
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.EqualTo(expectedOutput));
|
||||
@@ -58,11 +63,5 @@ namespace EmailProfilerDispatcher.Tests
|
||||
[TemplatePlaceholder("[DOCUMENT_TITLE]")]
|
||||
public string DocumentTitle { get; set; } = "Vertragsdokument";
|
||||
}
|
||||
|
||||
public class MailData3
|
||||
{
|
||||
[TemplatePlaceholder("[NAME_PORTAL]")]
|
||||
public string NamePortal { get; set; } = "DokumentenPortal";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user