-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bumped version to 5.6.1 - see changes in release comments
- Loading branch information
Showing
12 changed files
with
317 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using MailMergeLib; | ||
using NUnit.Framework; | ||
|
||
namespace UnitTests | ||
{ | ||
[TestFixture] | ||
public class HtmlBodyBuilderTest | ||
{ | ||
[TestCase("Temp")] | ||
[TestCase("..\\..\\temp")] | ||
public void SetHtmlBuilderDocBaseUri_UriFormatException(string baseUri) | ||
{ | ||
var mmm = new MailMergeMessage("subject", "plain text", "<html><head><base href=\"\" /></head><body></body></html>"); | ||
var hbb = new HtmlBodyBuilder(mmm, (object)null); | ||
Assert.Throws<UriFormatException>(() => hbb.DocBaseUri = baseUri); | ||
} | ||
|
||
[TestCase(null)] | ||
[TestCase("")] | ||
[TestCase("C:\\Temp")] | ||
[TestCase("\\\\some\\unc\\path")] | ||
public void SetHtmlBuilderDocBaseUri_NoException(string baseUri) | ||
{ | ||
var mmm = new MailMergeMessage("subject", "plain text", "<html><head><base href=\"\" /></head><body></body></html>"); | ||
var hbb = new HtmlBodyBuilder(mmm, (object)null); | ||
Assert.DoesNotThrow(() => hbb.DocBaseUri = baseUri); | ||
} | ||
|
||
[Test] | ||
public void ScriptTagRemoved() | ||
{ | ||
var mmm = new MailMergeMessage("subject_to_set", "plain text", "<html><head><script>var x='x';</script><script>var y='y';</script></head><body>some body</body></html>"); | ||
var hbb = new HtmlBodyBuilder(mmm, (object)null); | ||
var html = hbb.GetBodyPart(); | ||
Assert.IsTrue(html.ToString().Contains("some body")); | ||
Assert.IsTrue(!html.ToString().Contains("script")); | ||
} | ||
|
||
[Test] | ||
public void ExistingTitleTagSetWithSubject() | ||
{ | ||
var subjectToSet = "subject_to_set"; | ||
var mmm = new MailMergeMessage(subjectToSet, "plain text", "<html><head><title>abc</title></head><body></body></html>"); | ||
var hbb = new HtmlBodyBuilder(mmm, (object)null); | ||
var html = hbb.GetBodyPart(); | ||
Assert.IsTrue(html.ToString().Contains(subjectToSet)); | ||
} | ||
|
||
[Test] | ||
public void NonExistingTitleTagSetWithSubject() | ||
{ | ||
var subjectToSet = "subject_to_set"; | ||
var mmm = new MailMergeMessage(subjectToSet, "plain text", "<html><head></head><body></body></html>"); | ||
var hbb = new HtmlBodyBuilder(mmm, (object)null); | ||
var html = hbb.GetBodyPart(); | ||
Assert.IsTrue(!html.ToString().Contains(subjectToSet)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.