-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from PandaTechAM/development
mask class extension
- Loading branch information
Showing
4 changed files
with
15 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,13 @@ string maskedEmail = Mask.MaskEmail("[email protected]"); | |
string maskedPhone = Mask.MaskPhoneNumber("1234567890"); | ||
|
||
// Output: "******7890" | ||
// You can also use the MaskEmail and MaskPhoneNumber methods as extension methods on strings | ||
string maskedEmail = "[email protected]"; | ||
string maskedPhone = "1234567890"; | ||
|
||
string maskedEmail = maskedEmail.MaskEmail(); | ||
string maskedPhone = maskedPhone.MaskPhoneNumber(); | ||
``` | ||
|
||
## 1.5. License | ||
|
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ public class MaskTests | |
[InlineData("[email protected]", "[email protected]")] | ||
public void MaskEmail_ValidEmails_ReturnsMaskedEmail(string input, string expected) | ||
{ | ||
var result = Mask.MaskEmail(input); | ||
var result = input.MaskEmail(); | ||
Assert.Equal(expected, result); | ||
} | ||
|
||
|
@@ -22,7 +22,7 @@ public void MaskEmail_ValidEmails_ReturnsMaskedEmail(string input, string expect | |
[InlineData("notanemail")] | ||
public void MaskEmail_InvalidEmails_ThrowsArgumentException(string input) | ||
{ | ||
Assert.Throws<ArgumentException>(() => Mask.MaskEmail(input)); | ||
Assert.Throws<ArgumentException>(input.MaskEmail); | ||
} | ||
|
||
[Theory] | ||
|
@@ -31,7 +31,7 @@ public void MaskEmail_InvalidEmails_ThrowsArgumentException(string input) | |
[InlineData("12", "12")] | ||
public void MaskPhoneNumber_ValidPhoneNumbers_ReturnsMaskedPhone(string input, string expected) | ||
{ | ||
var result = Mask.MaskPhoneNumber(input); | ||
var result = input.MaskPhoneNumber(); | ||
Assert.Equal(expected, result); | ||
} | ||
|
||
|
@@ -40,6 +40,6 @@ public void MaskPhoneNumber_ValidPhoneNumbers_ReturnsMaskedPhone(string input, s | |
[InlineData("")] | ||
public void MaskPhoneNumber_InvalidPhoneNumbers_ThrowsArgumentException(string input) | ||
{ | ||
Assert.Throws<ArgumentException>(() => Mask.MaskPhoneNumber(input)); | ||
Assert.Throws<ArgumentException>(input.MaskPhoneNumber); | ||
} | ||
} |
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