-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored SMS, MMS & Mail generator.
Added more tests and removed empty paramters.
- Loading branch information
Showing
2 changed files
with
100 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,6 +437,58 @@ public void mail_should_build_type_mailto() | |
} | ||
|
||
|
||
[Fact] | ||
[Category("PayloadGenerator/Mail")] | ||
public void mail_should_build_type_mailto_receiver_only() | ||
{ | ||
var receiver = "[email protected]"; | ||
var encoding = PayloadGenerator.Mail.MailEncoding.MAILTO; | ||
|
||
var generator = new PayloadGenerator.Mail(mailReceiver: receiver, encoding: encoding); | ||
|
||
generator.ToString().ShouldBe("mailto:[email protected]"); | ||
} | ||
|
||
|
||
[Fact] | ||
[Category("PayloadGenerator/Mail")] | ||
public void mail_should_build_type_mailto_subject_only() | ||
{ | ||
var receiver = "[email protected]"; | ||
var subject = "A test mail"; | ||
var encoding = PayloadGenerator.Mail.MailEncoding.MAILTO; | ||
|
||
var generator = new PayloadGenerator.Mail(receiver, subject, encoding: encoding); | ||
|
||
generator.ToString().ShouldBe("mailto:[email protected]?subject=A%20test%20mail"); | ||
} | ||
|
||
[Fact] | ||
[Category("PayloadGenerator/Mail")] | ||
public void mail_should_build_type_mailto_message_only() | ||
{ | ||
var receiver = "[email protected]"; | ||
var message = "Just see if it works!"; | ||
var encoding = PayloadGenerator.Mail.MailEncoding.MAILTO; | ||
|
||
var generator = new PayloadGenerator.Mail(receiver, message: message, encoding: encoding); | ||
|
||
generator.ToString().ShouldBe("mailto:[email protected]?body=Just%20see%20if%20it%20works%21"); | ||
} | ||
|
||
[Fact] | ||
[Category("PayloadGenerator/Mail")] | ||
public void mail_should_build_type_mailto_no_receiver() | ||
{ | ||
var subject = "A test mail"; | ||
var message = "Just see if it works!"; | ||
var encoding = PayloadGenerator.Mail.MailEncoding.MAILTO; | ||
|
||
var generator = new PayloadGenerator.Mail(subject: subject, message: message, encoding: encoding); | ||
|
||
generator.ToString().ShouldBe("mailto:?subject=A%20test%20mail&body=Just%20see%20if%20it%20works%21"); | ||
} | ||
|
||
[Fact] | ||
[Category("PayloadGenerator/Mail")] | ||
public void mail_should_build_type_MATMSG() | ||
|
@@ -481,7 +533,6 @@ public void mail_should_escape_input_MATMSG() | |
generator.ToString().ShouldBe("MATMSG:TO:[email protected];SUB:A test mail;BODY:Just see if \\\\\\:\\;\\, it works!;;"); | ||
} | ||
|
||
|
||
[Fact] | ||
[Category("PayloadGenerator/Mail")] | ||
public void mail_should_escape_input_SMTP() | ||
|
@@ -496,19 +547,6 @@ public void mail_should_escape_input_SMTP() | |
generator.ToString().ShouldBe("SMTP:[email protected]:A test mail:Just see\\: if it works!"); | ||
} | ||
|
||
|
||
[Fact] | ||
[Category("PayloadGenerator/Mail")] | ||
public void mail_should_add_unused_params() | ||
{ | ||
var receiver = "[email protected]"; | ||
|
||
var generator = new PayloadGenerator.Mail(receiver); | ||
|
||
generator.ToString().ShouldBe("mailto:[email protected]?subject=&body="); | ||
} | ||
|
||
|
||
[Fact] | ||
[Category("PayloadGenerator/SMS")] | ||
public void sms_should_build_type_SMS() | ||
|
@@ -553,13 +591,13 @@ public void sms_should_build_type_SMSTO() | |
|
||
[Fact] | ||
[Category("PayloadGenerator/SMS")] | ||
public void sms_should_add_unused_params() | ||
public void sms_should_not_add_unused_params() | ||
{ | ||
var number = "01601234567"; | ||
|
||
var generator = new PayloadGenerator.SMS(number); | ||
|
||
generator.ToString().ShouldBe("sms:01601234567?body="); | ||
generator.ToString().ShouldBe("sms:01601234567"); | ||
} | ||
|
||
|
||
|
@@ -593,13 +631,13 @@ public void mms_should_build_type_MMSTO() | |
|
||
[Fact] | ||
[Category("PayloadGenerator/MMS")] | ||
public void mms_should_add_unused_params() | ||
public void mms_should_not_add_unused_params() | ||
{ | ||
var number = "01601234567"; | ||
|
||
var generator = new PayloadGenerator.MMS(number); | ||
|
||
generator.ToString().ShouldBe("mms:01601234567?body="); | ||
generator.ToString().ShouldBe("mms:01601234567"); | ||
} | ||
|
||
|
||
|