-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate email for member models (#17532)
* Validate email for member models * Add null check or more test cases * return invalid when not a valid email * Cleanup * remove private method in favor of extension * Remove non used, using statement --------- Co-authored-by: Elitsa <[email protected]>
- Loading branch information
Showing
4 changed files
with
26 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -364,6 +364,16 @@ public void IsFullPath() | |
TryIsFullPath(" ", false, false); // technically, a valid filename on Linux | ||
} | ||
|
||
[TestCase("[email protected]", true)] | ||
[TestCase("test@test", true)] | ||
[TestCase("testtest.com", false)] | ||
[TestCase("[email protected]", true)] | ||
[TestCase("[email protected]", true)] | ||
[TestCase(null, false)] | ||
[TestCase("", false)] | ||
[TestCase(" ", false)] | ||
public void IsEmail(string? email, bool isEmail) => Assert.AreEqual(isEmail, email.IsEmail()); | ||
|
||
private static void TryIsFullPath(string path, bool expectedIsFull, bool expectedIsValid = true) | ||
{ | ||
Assert.AreEqual(expectedIsFull, path.IsFullPath(), "IsFullPath('" + path + "')"); | ||
|