Skip to content

Commit

Permalink
verifying GetSegmentName
Browse files Browse the repository at this point in the history
  • Loading branch information
RLittlesII committed May 8, 2024
1 parent 425799d commit fa65a64
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Prism.Core/Common/UriParsingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static INavigationParameters GetSegmentParameters(string uriSegment, INav
{
var navParameters = GetSegmentParameters(uriSegment);

if (parameters != null)
if (parameters is not null)
{
foreach (KeyValuePair<string, object> navigationParameter in parameters)
{
Expand Down Expand Up @@ -154,7 +154,14 @@ public static INavigationParameters ParseQuery(Uri uri)
/// <param name="uri">A uri string.</param>
/// <returns>A <see cref="Uri"/>.</returns>
/// <exception cref="ArgumentNullException">Throws an <see cref="ArgumentNullException"/> when the string is null or empty.</exception>
public static Uri Parse(string uri) => uri.StartsWith("/", StringComparison.Ordinal) ? new Uri("http://localhost" + uri, UriKind.Absolute) : new Uri(uri, UriKind.RelativeOrAbsolute);
public static Uri Parse(string uri)
{
ArgumentNullException.ThrowIfNull(uri);

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-core / Build Prism.Core

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-core / Build Prism.Core

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-core / Build Prism.Core

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-core / Build Prism.Core

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-core / Build Prism.Core

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-core / Build Prism.Core

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-wpf / Build Prism.Wpf

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-wpf / Build Prism.Wpf

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-wpf / Build Prism.Wpf

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-wpf / Build Prism.Wpf

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-wpf / Build Prism.Wpf

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-wpf / Build Prism.Wpf

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-forms / Build Prism.Forms

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-forms / Build Prism.Forms

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-forms / Build Prism.Forms

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-maui / Build Prism.Maui

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-maui / Build Prism.Maui

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-maui / Build Prism.Maui

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-maui / Build Prism.Maui

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-maui / Build Prism.Maui

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-maui / Build Prism.Maui

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-uno / Build Prism.Uno

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-uno / Build Prism.Uno

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

Check failure on line 159 in src/Prism.Core/Common/UriParsingHelper.cs

View workflow job for this annotation

GitHub Actions / build-prism-uno / Build Prism.Uno

'ArgumentNullException' does not contain a definition for 'ThrowIfNull'

return uri.StartsWith("/", StringComparison.Ordinal)
? new Uri("http://localhost" + uri, UriKind.Absolute)
: new Uri(uri, UriKind.RelativeOrAbsolute);
}

/// <summary>
/// This will provide the existing <see cref="Uri"/> if it is already Absolute, otherwise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ public void ParametersParsedFromNavigationParametersInAbsoluteUri()
Assert.Equal("dan", parameters["name"]);
}

[Fact]
public void TargetNameParsedFromEmptySegment()
{
var target = UriParsingHelper.GetSegmentName(string.Empty);
Assert.Equal(string.Empty, target);
}

[Fact]
public void TargetNameParsedFromSingleSegment()
{
Expand Down

0 comments on commit fa65a64

Please sign in to comment.