You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing an encoded string (like: http://localhost/white%20space) to the FakeNavigationManager.NavigateTo method, the encoded part will be decoded. The "normal" NavigationManager used in Blazor pages does not have this behavior.
This is specially interesting when you use functions like Uri.EscapeDataString
Example:
The following test will fail:
[Fact]publicvoidShouldConsiderEncodedData(){varfake= Services.GetService<NavigationManager>();varencoded="with%20whitespace";// You could also use var encoded = Uri.EncodeDataString("with whitespace");
fake.NavigateTo(encoded);
fake.Uri.Should().EndWith("with%20whitespace");}
with:
Expected fake.Uri "http://localhost/with whitespace" to end with "with%20whitespace"
If you need a small working example for the "real" NavigationManager:
Describe the bug
When passing an encoded string (like:
http://localhost/white%20space
) to theFakeNavigationManager.NavigateTo
method, the encoded part will be decoded. The "normal" NavigationManager used in Blazor pages does not have this behavior.This is specially interesting when you use functions like
Uri.EscapeDataString
Example:
The following test will fail:
with:
If you need a small working example for the "real" NavigationManager:
This will navigate to
https://localhost:5001/with%20whitespace
Expected behavior:
The
FakeNavigationManager
does not decode encoded uri's.Version info:
The text was updated successfully, but these errors were encountered: