Skip to content

Commit

Permalink
chore: fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Sep 3, 2023
1 parent dcda09c commit e93f00c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
10 changes: 3 additions & 7 deletions src/Forms/Prism.Forms.Regions/Regions/Region.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private void InnerAdd(object view, string viewName, IRegionManager scopedRegionM
/// </summary>
/// <param name="viewName">The name used when adding the view to the region.</param>
/// <returns>Returns the named view or <see langword="null"/> if the view with <paramref name="viewName"/> does not exist in the current region.</returns>
public virtual VisualElement GetView(string viewName)
public virtual object GetView(string viewName)
{
if (string.IsNullOrEmpty(viewName))
{
Expand Down Expand Up @@ -431,14 +431,10 @@ private static int ViewSortHintAttributeComparison(ViewSortHintAttribute x, View
}
}

object IRegion.GetView(string viewName)
{
throw new NotImplementedException();
}

/// <inheritDoc />
public void RequestNavigate(Uri target, Action<NavigationResult> navigationCallback, INavigationParameters navigationParameters)
{
throw new NotImplementedException();
_regionNavigationService.RequestNavigate(target, navigationCallback, navigationParameters);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public void WhenNavigatingWithARelativeStringTarget_ThenNavigatesToRelativeUri()
.Setup(nv =>
nv.RequestNavigate(
It.Is<Uri>(u => !u.IsAbsoluteUri && u.OriginalString == "relative"),
It.Is<Action<NavigationResult>>(c => c != null)))
It.Is<Action<NavigationResult>>(c => c != null),
It.Is<INavigationParameters>(p => p != null)))
.Verifiable();

string target = "relative";
Expand All @@ -62,7 +63,8 @@ public void WhenNavigatingWithAnAbsoluteStringTarget_ThenNavigatesToAbsoluteUri(
.Setup(nv =>
nv.RequestNavigate(
It.Is<Uri>(u => u.IsAbsoluteUri && u.Host == "test" && u.AbsolutePath == "/path"),
It.Is<Action<NavigationResult>>(c => c != null)))
It.Is<Action<NavigationResult>>(c => c != null),
It.Is<INavigationParameters>(p => p != null)))
.Verifiable();

string target = "http://test/path";
Expand Down Expand Up @@ -95,7 +97,8 @@ public void WhenNavigatingWithAUri_ThenNavigatesToUriWithCallback()
.Setup(nv =>
nv.RequestNavigate(
target,
It.Is<Action<NavigationResult>>(c => c != null)))
It.Is<Action<NavigationResult>>(c => c != null),
It.Is<INavigationParameters>(p => p != null)))
.Verifiable();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public void WhenNonExistentRegion_ReturnNavigationResultFalse()
public void DelegatesCallToRegion_RegionSource()
{
regionManager.RequestNavigate(region, source);
mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny<Action<NavigationResult>>(), null));
mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny<Action<NavigationResult>>(), It.IsAny<INavigationParameters>()));
}

[Fact]
public void DelegatesCallToRegion_RegionTarget()
{
regionManager.RequestNavigate(region, sourceUri);
mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny<Action<NavigationResult>>(), null));
mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny<Action<NavigationResult>>(), It.IsAny<INavigationParameters>()));
}

[Fact]
Expand All @@ -104,14 +104,14 @@ public void DelegatesCallToRegion_RegionSourceUriParameters()
public void DelegatesCallToRegion_RegionSourceCallback()
{
regionManager.RequestNavigate(region, source, callback);
mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, callback, null));
mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, callback, It.IsAny<INavigationParameters>()));
}

[Fact]
public void DelegatesCallToRegion_RegionTargetCallback()
{
regionManager.RequestNavigate(region, sourceUri, callback);
mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, callback, null));
mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, callback, It.IsAny<INavigationParameters>()));
}

[Fact]
Expand Down

0 comments on commit e93f00c

Please sign in to comment.