NUnit下的System.Uri分析无效

本文关键字:无效 Uri 下的 System NUnit | 更新日期: 2023-09-27 18:24:03

在ReSharper下,从GUI Runner,从NUnit控制台再现

测试日期:

Win 7 Pro,所有更新,Ru-Ru区域设置-再现

Win Server 2012,所有更新En us locale-再现

试试这个:

[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());
    }
}

预期:

Uri未更改,并且"http://host.com/path./"返回

实际:

裁剪"http://host.com/path/"返回

注:

  1. 它已损坏,而裁剪的Uri与所需资源不匹配

  2. 这种行为从未在生产中发生过,除非在NUNIT运行下,否则无法捕获。

  3. 已经比较了所有加载的程序集版本和代码库-所有版本都与生产完全匹配

  4. 已经测试了互联网上的这个问题-没有

希望你能再生。

NUnit 2.6.2和2.6.3版本具有相同的行为。

已将我们的问题发布到https://github.com/nunit/nunit/issues/237

NUnit下的System.Uri分析无效

NUnit的伙计们检查了一下,发现这是.NET 4.5的一个损坏的更改,所以如果NUnit将针对这个版本进行重建,一切都会好起来的。Uri规范化是以前所有版本.net的一个类似bug的特性,幸运的是我刚刚遇到了它…