In the following tests, why does (only) the last one fail?
[Fact]
public void IsWellFormedUriString_AbsolutNonHashTagUri_ReturnsTrue()
{
Assert.True(Uri.IsWellFormedUriString("http://www.RegularSite.org/Home", UriKind.Absolute));
}
[Fact]
public void IsWellFormedUriString_RelativeNonHashTagUri_ReturnsTrue()
{
Assert.True(Uri.IsWellFormedUriString("Home", UriKind.Relative));
}
[Fact]
public void IsWellFormedUriString_AbsolutHashTagUri_ReturnsTrue()
{
Assert.True(Uri.IsWellFormedUriString("http://www.w3.org/#!Home", UriKind.Absolute));
}
[Fact]
public void IsWellFormedUriString_RelativeHashTagUri_ReturnsTrue()
{
// Fails!
Assert.True(Uri.IsWellFormedUriString("#!Home", UriKind.Relative));
}
If Uri
recognizes Hashbangs in the Absolute version of IsWellFormedUriString
, why not in the Relative version? What am I missing?
Note: This doesn't help.