Skip to content

Commit

Permalink
(#672) Added better ID detection (#674)
Browse files Browse the repository at this point in the history
* (#672) Added better ID detection
  • Loading branch information
adrianhall committed May 11, 2023
1 parent 11e82b2 commit 8f3d441
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions sdk/dotnet/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
# Restore Workloads
dotnet workload restore --project .\src\Microsoft.Datasync.Client\Microsoft.Datasync.Client.csproj

# Restore NuGet Packages
dotnet restore .\Datasync.Framework.sln

# Build
msbuild -property:Configuration=Release ./Datasync.Framework.sln

# Test
vstest.console --collect:"Code Coverage" .\test\**\bin\Release\**\Microsoft.*.Test.dll

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static class Arguments
/// as a path segment according to RFC 2396. It must also be suitable for storing
/// a GUID, and for storing in a database string.
/// </remarks>
private static readonly Regex validIdRegex = new("^[a-zA-Z0-9][a-zA-Z0-9-_.]{0,126}$");
private static readonly Regex validIdRegex = new("^[a-zA-Z0-9][a-zA-Z0-9_.|:-]{0,126}$");

/// <summary>
/// Returns if the parameter is not null.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ public void IsValidId_Null_Throws()
[InlineData(" ")]
[InlineData("\t")]
[InlineData("abcdef gh")]
[InlineData("!!!")]
[InlineData("?")]
[InlineData(";")]
[InlineData("{EA235ADF-9F38-44EA-8DA4-EF3D24755767}")]
[InlineData("###")]
[InlineData("!!!")]
[Trait("Method", "IsValidId")]
public void IsValidId_InvalidId_Throws(string sut)
{
Expand All @@ -136,6 +136,7 @@ public void IsValidId_InvalidId_Throws(string sut)
[InlineData("db0ec08d-46a9-465d-9f5e-0066a3ee5b5f")]
[InlineData("0123456789")]
[InlineData("abcdefgh")]
[InlineData("2023|05|01_120000")]
[InlineData("db0ec08d_46a9_465d_9f5e_0066a3ee5b5f")]
[InlineData("db0ec08d.46a9.465d.9f5e.0066a3ee5b5f")]
[Trait("Method", "IsValidId")]
Expand Down

0 comments on commit 8f3d441

Please sign in to comment.