@@ -330,6 +330,21 @@ public void TestCreateSingleEmail()
330330 "Plain Text Content" ,
331331 null ) ;
332332 Assert . True ( msg3 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject\" }],\" content\" :[{\" type\" :\" text/plain\" ,\" value\" :\" Plain Text Content\" }]}" ) ; 333+
334+ var msg4 = MailHelper . CreateSingleEmail ( new EmailAddress ( "[email protected] " , "Example User" ) , 335+ new EmailAddress ( "[email protected] " ) , 336+ "Test Subject" ,
337+ "" ,
338+ "HTML Content" ) ;
339+ Assert . True ( msg4 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject\" }],\" content\" :[{\" type\" :\" text/html\" ,\" value\" :\" HTML Content\" }]}" ) ; 340+
341+ var msg5 = MailHelper . CreateSingleEmail ( new EmailAddress ( "[email protected] " , "Example User" ) , 342+ new EmailAddress ( "[email protected] " ) , 343+ "Test Subject" ,
344+ "Plain Text Content" ,
345+ "" ) ;
346+ Assert . True ( msg5 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject\" }],\" content\" :[{\" type\" :\" text/plain\" ,\" value\" :\" Plain Text Content\" }]}" ) ; 347+
333348 }
334349
335350 [ Fact ]
@@ -363,6 +378,21 @@ public void TestCreateSingleEmailToMultipleRecipients()
363378 ) ;
364379 Assert . True ( msg3 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" subject\" :\" Test Subject\" ,\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }]},{\" to\" :[{\" email\" :\" [email protected] \" }]},{\" to\" :[{\" email\" :\" [email protected] \" }]}],\" content\" :[{\" type\" :\" text/plain\" ,\" value\" :\" Plain Text Content\" }]}" ) ; 365380
381+ var msg4 = MailHelper . CreateSingleEmailToMultipleRecipients ( new EmailAddress ( "[email protected] " , "Example User" ) , 382+ emails ,
383+ "Test Subject" ,
384+ "" ,
385+ "HTML Content"
386+ ) ;
387+ Assert . True ( msg4 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" subject\" :\" Test Subject\" ,\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }]},{\" to\" :[{\" email\" :\" [email protected] \" }]},{\" to\" :[{\" email\" :\" [email protected] \" }]}],\" content\" :[{\" type\" :\" text/html\" ,\" value\" :\" HTML Content\" }]}" ) ; 388+
389+ var msg5 = MailHelper . CreateSingleEmailToMultipleRecipients ( new EmailAddress ( "[email protected] " , "Example User" ) , 390+ emails ,
391+ "Test Subject" ,
392+ "Plain Text Content" ,
393+ ""
394+ ) ;
395+ Assert . True ( msg5 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" subject\" :\" Test Subject\" ,\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }]},{\" to\" :[{\" email\" :\" [email protected] \" }]},{\" to\" :[{\" email\" :\" [email protected] \" }]}],\" content\" :[{\" type\" :\" text/plain\" ,\" value\" :\" Plain Text Content\" }]}" ) ; 366396 }
367397
368398 [ Fact ]
@@ -412,6 +442,28 @@ public void TestCreateMultipleEmailsToMultipleRecipients()
412442 substitutions
413443 ) ;
414444 Assert . True ( msg3 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject1\" ,\" substitutions\" :{\" -name-\" :\" Name1\" }},{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject2\" ,\" substitutions\" :{\" -name-\" :\" Name1\" }},{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject3\" ,\" substitutions\" :{\" -name-\" :\" Name1\" }}],\" content\" :[{\" type\" :\" text/plain\" ,\" value\" :\" Hello -name-\" }]}" ) ; 445+
446+ plainTextContent = "" ;
447+ htmlContent = "Goodbye -name-" ;
448+ var msg4 = MailHelper . CreateMultipleEmailsToMultipleRecipients ( new EmailAddress ( "[email protected] " , "Example User" ) , 449+ emails ,
450+ subjects ,
451+ plainTextContent ,
452+ htmlContent ,
453+ substitutions
454+ ) ;
455+ Assert . True ( msg4 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject1\" ,\" substitutions\" :{\" -name-\" :\" Name1\" }},{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject2\" ,\" substitutions\" :{\" -name-\" :\" Name1\" }},{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject3\" ,\" substitutions\" :{\" -name-\" :\" Name1\" }}],\" content\" :[{\" type\" :\" text/html\" ,\" value\" :\" Goodbye -name-\" }]}" ) ; 456+
457+ plainTextContent = "Hello -name-" ;
458+ htmlContent = "" ;
459+ var msg5 = MailHelper . CreateMultipleEmailsToMultipleRecipients ( new EmailAddress ( "[email protected] " , "Example User" ) , 460+ emails ,
461+ subjects ,
462+ plainTextContent ,
463+ htmlContent ,
464+ substitutions
465+ ) ;
466+ Assert . True ( msg5 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject1\" ,\" substitutions\" :{\" -name-\" :\" Name1\" }},{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject2\" ,\" substitutions\" :{\" -name-\" :\" Name1\" }},{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject3\" ,\" substitutions\" :{\" -name-\" :\" Name1\" }}],\" content\" :[{\" type\" :\" text/plain\" ,\" value\" :\" Hello -name-\" }]}" ) ; 415467 }
416468
417469 [ Fact ]
0 commit comments