-
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.
Enable Nullable Reference Types (NRT) (#30)
* Migrate project MailMergeLib * MailMergeMessage_Exceptions: Allow null for inner Exception * Migrate project MailMergeLib.Tests
- Loading branch information
Showing
49 changed files
with
571 additions
and
563 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
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 |
---|---|---|
|
@@ -126,8 +126,7 @@ public void HtmlStreamAttachments() | |
Assert.IsTrue(mmm.StreamAttachments.Count == 1); | ||
mmm.StreamAttachments.Clear(); | ||
Assert.IsTrue(mmm.StreamAttachments.Count == 0); | ||
mmm.StreamAttachments = null; | ||
Assert.IsTrue(mmm.StreamAttachments != null && mmm.StreamAttachments.Count == 0); | ||
|
||
mmm.StreamAttachments = streamAttachments; | ||
Assert.IsTrue(mmm.StreamAttachments.Count == 2); | ||
} | ||
|
@@ -154,7 +153,7 @@ public void HtmlMailMergeWithStreamAttachment() | |
mmm.StreamAttachments.Clear(); | ||
mmm.StringAttachments.Clear(); | ||
|
||
using var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(text ?? string.Empty)); | ||
using var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(text)); | ||
mmm.StreamAttachments.Add(new StreamAttachment(stream, streamAttFilename, "text/plain")); | ||
|
||
var msg = mmm.GetMimeMessage(dataItem); | ||
|
@@ -291,7 +290,7 @@ public void ConvertHtmlToPlainText() | |
[TestCase("{Name} {SenderAddr}", "John [email protected]")] | ||
[TestCase("{Name {SenderAddr}", "{Name {SenderAddr}")] // parsing error | ||
[TestCase("{NotExisting}", "{NotExisting}")] // formatting error | ||
[TestCase(null, null)] | ||
[TestCase("", "")] | ||
public void SearchAndReplace(string text, string expected) | ||
{ | ||
var dataItem = new | ||
|
@@ -310,7 +309,7 @@ public void SearchAndReplace(string text, string expected) | |
[TestCase("{Name} {SenderAddr}", "John [email protected]")] | ||
[TestCase("{Name {SenderAddr}", "{Name {SenderAddr}")] // parsing error | ||
[TestCase("{NotExisting}", "{NotExisting}")] // formatting error | ||
[TestCase(null, null)] | ||
[TestCase("", "")] | ||
public void SearchAndReplaceFilename(string text, string expected) | ||
{ | ||
var dataItem = new | ||
|
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 |
---|---|---|
|
@@ -58,7 +58,7 @@ public void PlaceholderCaseSensitivityTest() | |
public void DataTypeTests() | ||
{ | ||
// ******** Initialize ******** | ||
string result; | ||
string? result; | ||
string expected; | ||
object dataItem; | ||
var culture = CultureInfo.GetCultureInfo("en-US"); | ||
|
@@ -171,7 +171,7 @@ public void DataTypeTests() | |
catch (MailMergeMessage.MailMergeMessageException ex) | ||
{ | ||
// will throw because of incomplete mail addresses, but Subject should contain placeholders replaced with content | ||
result = ex.MimeMessage.Subject; | ||
result = ex.MimeMessage?.Subject; | ||
} | ||
|
||
expected = text.Replace("{Email}", "[email protected]").Replace("{Continent}", "Europe"); | ||
|
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
Oops, something went wrong.