-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Lib.Tests project * Modify regex for phone number validation * Add tests for valid phone numbers * Add check for valid phone number
- Loading branch information
1 parent
c438857
commit 7a35836
Showing
7 changed files
with
100 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<!-- Core properties --> | ||
<PropertyGroup> | ||
<RootNamespace>EntraMfaPrefillinator.Lib.Tests</RootNamespace> | ||
<AssemblyName>EntraMfaPrefillinator.Lib.Tests</AssemblyName> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
<!-- Package properties --> | ||
<PropertyGroup> | ||
<PackageId>EntraMfaPrefillinator.Lib.Tests</PackageId> | ||
<Description> | ||
Tests for the lass library for EntraMfaPrefillinator. | ||
</Description> | ||
<Authors>Timothy Small</Authors> | ||
<Company>Smalls.Online</Company> | ||
<Copyright>© Smalls.Online</Copyright> | ||
<RepositoryUrl>https://github.com/Smalls1652/EntraMfaPrefillinator</RepositoryUrl> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
</PropertyGroup> | ||
<!-- Dependencies --> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
<PackageReference Include="MSTest" /> | ||
<ProjectReference Include="../Lib/Lib.csproj" /> | ||
</ItemGroup> | ||
<!-- Additional settings --> | ||
<ItemGroup> | ||
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" /> | ||
</ItemGroup> | ||
</Project> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using EntraMfaPrefillinator.Lib.Utilities; | ||
|
||
namespace EntraMfaPrefillinator.Lib.Tests.Regex; | ||
|
||
[TestClass] | ||
public sealed class CsvDataRegexTests | ||
{ | ||
[TestMethod] | ||
[DataRow("(555) 555-5555")] | ||
[DataRow("(555) 5555555")] | ||
[DataRow("(555)-5555555")] | ||
[DataRow("555 555-5555")] | ||
[DataRow("555-555-5555")] | ||
public void IsValidPhoneNumber_ReturnTrue(string value) | ||
{ | ||
bool result = CsvDataRegexTools.IsValidPhoneNumber(value); | ||
|
||
Assert.IsTrue(result, $"{value} should be true"); | ||
} | ||
|
||
[TestMethod] | ||
[DataRow("(555) 5555-5555")] | ||
[DataRow("(5555) 5555-5555")] | ||
[DataRow("[555] 555-55555")] | ||
public void IsValidPhoneNumber_ReturnFalse(string value) | ||
{ | ||
bool result = CsvDataRegexTools.IsValidPhoneNumber(value); | ||
|
||
Assert.IsFalse(result, message: $"{value} should be false"); | ||
} | ||
} |
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