public Parse ( string readAllText ) : EmailTemplate | ||
readAllText | string | |
Résultat | EmailTemplate |
public void EmailTemplateManager_LoadingTemplates_CanLoadATemplateXml() { ITemplateParser templateParser = new TemplateParser(); var template = templateParser.Parse(File.ReadAllText("templates\\SampleEmailTemplate.xml")); Assert.That(template.Name, Is.StringMatching("templateName")); Assert.That(template.Subject, Is.StringMatching("test email subject")); Assert.That(template.From, Is.StringMatching("*****@*****.**")); Assert.That(template.Html, Is.StringMatching("html body")); Assert.That(template.Text, Is.StringMatching("text body")); Assert.That(template.Culture, Is.StringMatching("en")); }
public void EmailTemplateManager_LoadingTemplates_CanLoadATemplateXml() { ITemplateParser templateParser = new TemplateParser(); var template = templateParser.Parse(File.ReadAllText("SampleEmailTemplate.xml")); Assert.That(template.Name, Is.StringMatching("templateName")); Assert.That(template.Subject, Is.StringMatching("test email subject")); Assert.That(template.From, Is.StringMatching("*****@*****.**")); Assert.That(template.Html, Is.StringMatching("html body")); Assert.That(template.Text, Is.StringMatching("text body")); Assert.That(template.Tokens, Has.Count.EqualTo(3)); Assert.That(template.Tokens, Has.Some.InstanceOf(typeof(string)).And.EqualTo("subjectToken")); Assert.That(template.Tokens, Has.Some.InstanceOf(typeof(string)).And.EqualTo("htmlBodyToken")); Assert.That(template.Tokens, Has.Some.InstanceOf(typeof(string)).And.EqualTo("textBodyToken")); }