@@ -316,6 +316,20 @@ public void TestCreateSingleEmail()
316316 "Plain Text Content" ,
317317 "HTML Content" ) ;
318318 Assert . True ( msg . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject\" }],\" content\" :[{\" type\" :\" text/plain\" ,\" value\" :\" Plain Text Content\" },{\" type\" :\" text/html\" ,\" value\" :\" HTML Content\" }]}" ) ; 319+
320+ var msg2 = MailHelper . CreateSingleEmail ( new EmailAddress ( "[email protected] " , "Example User" ) , 321+ new EmailAddress ( "[email protected] " ) , 322+ "Test Subject" ,
323+ null ,
324+ "HTML Content" ) ;
325+ Assert . True ( msg2 . Serialize ( ) == "{\" from\" :{\" name\" :\" Example User\" ,\" email\" :\" [email protected] \" },\" personalizations\" :[{\" to\" :[{\" email\" :\" [email protected] \" }],\" subject\" :\" Test Subject\" }],\" content\" :[{\" type\" :\" text/html\" ,\" value\" :\" HTML Content\" }]}" ) ; 326+
327+ var msg3 = MailHelper . CreateSingleEmail ( new EmailAddress ( "[email protected] " , "Example User" ) , 328+ new EmailAddress ( "[email protected] " ) , 329+ "Test Subject" ,
330+ "Plain Text Content" ,
331+ null ) ;
332+ 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\" }]}" ) ; 319333 }
320334
321335 [ Fact ]
@@ -332,6 +346,23 @@ public void TestCreateSingleEmailToMultipleRecipients()
332346 "HTML Content"
333347 ) ;
334348 Assert . True ( msg . 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\" },{\" type\" :\" text/html\" ,\" value\" :\" HTML Content\" }]}" ) ; 349+
350+ var msg2 = MailHelper . CreateSingleEmailToMultipleRecipients ( new EmailAddress ( "[email protected] " , "Example User" ) , 351+ emails ,
352+ "Test Subject" ,
353+ null ,
354+ "HTML Content"
355+ ) ;
356+ Assert . True ( msg2 . 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\" }]}" ) ; 357+
358+ var msg3 = MailHelper . CreateSingleEmailToMultipleRecipients ( new EmailAddress ( "[email protected] " , "Example User" ) , 359+ emails ,
360+ "Test Subject" ,
361+ "Plain Text Content" ,
362+ null
363+ ) ;
364+ 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\" }]}" ) ; 365+
335366 }
336367
337368 [ Fact ]
@@ -359,6 +390,28 @@ public void TestCreateMultipleEmailsToMultipleRecipients()
359390 substitutions
360391 ) ;
361392 Assert . True ( msg . 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-\" },{\" type\" :\" text/html\" ,\" value\" :\" Goodbye -name-\" }]}" ) ; 393+
394+ plainTextContent = null ;
395+ htmlContent = "Goodbye -name-" ;
396+ var msg2 = MailHelper . CreateMultipleEmailsToMultipleRecipients ( new EmailAddress ( "[email protected] " , "Example User" ) , 397+ emails ,
398+ subjects ,
399+ plainTextContent ,
400+ htmlContent ,
401+ substitutions
402+ ) ;
403+ Assert . True ( msg2 . 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-\" }]}" ) ; 404+
405+ plainTextContent = "Hello -name-" ;
406+ htmlContent = null ;
407+ var msg3 = MailHelper . CreateMultipleEmailsToMultipleRecipients ( new EmailAddress ( "[email protected] " , "Example User" ) , 408+ emails ,
409+ subjects ,
410+ plainTextContent ,
411+ htmlContent ,
412+ substitutions
413+ ) ;
414+ 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-\" }]}" ) ; 362415 }
363416
364417 [ Fact ]
0 commit comments