Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AbsoluteUri in FakeNavigationManager to preserve escpaed uri's #460

Merged
merged 4 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ List of fixes in this release.

- Fixed issue where a registered fall-back service provider was not made available to resolve service dependencies of components under test. Thanks to [@dady8889](https://github.com/dady8889) for the reporting the issue.

- Fixed handling of escaped uri's in FakeNavigationManager. By [@linkdotnet](https://github.com/linkdotnet) in [#460](https://github.com/bUnit-dev/bUnit/pull/460)

## [1.1.5] - 2021-04-30

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public FakeNavigationManager(ITestRenderer renderer)
/// <inheritdoc/>
protected override void NavigateToCore(string uri, bool forceLoad)
{
Uri = ToAbsoluteUri(uri).ToString();
Uri = ToAbsoluteUri(uri).OriginalString;

renderer.Dispatcher.InvokeAsync(
() => NotifyLocationChanged(isInterceptedLink: false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void Test003(string uri)
sut.Uri.ShouldBe(expectedUri.ToString());
}

[Theory(DisplayName = "NavigateTo with absolute URI sets the Uri property ")]
[Theory(DisplayName = "NavigateTo with absolute URI sets the Uri property")]
[InlineData("http://localhost")]
[InlineData("http://localhost/")]
[InlineData("http://localhost/foo")]
Expand All @@ -54,7 +54,7 @@ public void Test004(string uri)

sut.NavigateTo(uri);

sut.Uri.ShouldBe(expectedUri.ToString());
sut.Uri.ShouldBe(expectedUri.OriginalString);
}

[Fact(DisplayName = "NavigateTo raises the NotifyLocationChanged")]
Expand Down Expand Up @@ -91,5 +91,15 @@ public void Test006()

cut.Markup.ShouldBe($"{sut.BaseUri}foo");
}

[Fact(DisplayName = "Uri should not be unescaped")]
public void Test007()
{
var sut = CreateFakeNavigationMananger();

sut.NavigateTo("/with%20whitespace");

sut.Uri.ShouldEndWith("with%20whitespace");
}
}
}