Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8462079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:04:14+00:00 2026-06-10T14:04:14+00:00

In the following tests, why does (only) the last one fail? [Fact] public void

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:04:16+00:00Added an answer on June 10, 2026 at 2:04 pm

    The reason this isn’t working as you’d expect is because a hashbang isn’t part of the URI Scheme. The method is expecting the hierarchical part of the URI format and a hash mark (and subsequently a hashbang) is not a member of the hierarchical part from which a relative and absolute path is determined.

    < > is a required part
    [ ] is an optional part

    <scheme name> : <hierarchical part> [ ? <query> ] [ # <fragment> ]

    as an example of an absolute URI; the query, if I’m not mistaken is ignored, which includes the fragment and hash mark

    http://domain.com/path/to/something/?query=1#fragment

    Here is some more information for you as well. This is all from the MSDN describing the Uri.IsWellFormedUriString() method

    Indicates whether the string is well-formed by attempting to construct a URI with the
    string and ensures that the string does not require further escaping.

    Remarks:

    By default, the string is considered well-formed in accordance with RFC 2396 and RFC 2732. If International Resource Identifiers (IRIs) or Internationalized Domain Name (IDN) parsing is enabled, the string is considered well-formed in accordance with RFC 3986 and RFC 3987.

    The string is considered poorly formed, causing the method to return false, if any of the following conditions occur

    The following are some failure examples:

    http://www.contoso.com/path???/file name
    The string is not correctly escaped.

    c:\directory\filename
    The string is an absolute Uri that represents an implicit file Uri.

    file://c:/directory/filename
    The string is an absolute URI that is missing a slash before the path.

    http:\host/path/file
    The string contains unescaped backslashes even if they will be treated as forward slashes

    http://www.contoso.com/path/file

    The string represents a hierarchical absolute Uri and does not contain “://”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It seems like EasyMock tests tend to follow the following pattern: @Test public void
Almost all of my JUnit tests are written with the following signature: public void
I'm trying to understand why the following test does not fail. In this simplified
I have the following controller: class Tests extends CI_Controller { public function update_record_test() {
I'm running my unit tests on a piece of code that does the following
consider the following test class: [TestClass] public class ExampleTests { [TestMethod] public void FileDoesNotExists()
In the following code, the first test passes, and the second one does not,
why does the following js expression: test1 foo bar test2.replace(/foo.bar/, $') result in the
When running some tests I came across the following issue. When using: private String
While doing some JavaScript performance tests I came up with the following piece of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.