Uri.ToString behaves differently on build server

I have a unit test that runs locally but does not work on the build server.

Here's the test:

[Test]
public void Test_UriToStringInCI()
{
    Assert.That(new Uri("http://example.com:64625/rules?q=some%2Ffeature").ToString(), Is.EqualTo("http://example.com:64625/rules?q=some%2Ffeature"));
}

      

Here's the answer I'm returning from the build server:

Expected: " http://example.com:64625/rules?q=some%2Ffeature "

But it was: " http://example.com:64625/rules?q=some/feature "

NOTE. Difference on build server: "/" in "some / feature" is decoded when locally it is not.

Why is my local machine behaving differently?

EDIT - additional information

It looks like the CI server is behaving correctly. According to this link Uri.ToString () should escape all characters, and Uri.OriginalString is the property I should be looking at.

So what happened to my local machine?

+3


source to share





All Articles