Invalid System.Uri parsing under NUnit

本秂侑毒 提交于 2019-12-23 20:36:37

问题


Reproduced under ReSharper, from GUI-Runner, from NUnit-Console

Tested on :

Win 7 Pro, all updates, Ru-ru locale - reproduced

Win Server 2012, all updates En-us locale - reproduced

Try this:

[TestFixture(Description = "Uri .ctors under Nunit must work exactly as no under Nunit")]
public class InvalidUriCtorUnderNnit
{
    [Test]
    public void PathsWithDotsMustBeParsedWell()
    {
        const string urlWithDots = "http://host.com/path./";
        Assert.AreEqual(urlWithDots, new Uri(urlWithDots).ToString());
    }
}

Expected:

Uri not changed and "http://host.com/path./" returned

Actual:

Cropped "http://host.com/path/" returned

Notes:

  1. It's broken, while cropped Uri not matched required resource

  2. This behavior never occured in production and cannot be catched except under NUNIT run.

  3. Have compared all loaded assemblies versions and codebase - all exactly match with production

  4. Have tested Internet on this issue - nothing

Wish you could reproduce.

NUnit version 2.6.2 and 2.6.3 have same behavior.

Have posted us issue to https://github.com/nunit/nunit/issues/237


回答1:


Guys from NUnit check it and founs that it's one of broken changes of .NET 4.5, so if NUnit will be rebuilt targeting this version all will be fine. Uri normalization was a feature-like-bug of all versions of .net before and it was my luck that i have just met it...



来源:https://stackoverflow.com/questions/25968963/invalid-system-uri-parsing-under-nunit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!