gpt4 book ai didi

c# - NUnit 下无效的 System.Uri 解析

转载 作者:行者123 更新时间:2023-11-30 16:10:21 25 4
gpt4 key购买 nike

转载于ReSharper下,来自GUI-Runner,来自NUnit-Console

测试于:

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 not changed and "http://host.com/path./" returned

实际:

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

注意事项:

  1. 它坏了,裁剪后的 Uri 与所需资源不匹配

  2. 这种行为从未在生产中发生过,除非在 NUNIT 运行下才能被捕获。

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

  4. 在这个问题上测试了 Internet - 没有

希望你能重现。

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

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

最佳答案

来自 NUnit 的人检查了它并发现它是 .NET 4.5 的破坏性更改之一,因此如果 NUnit 将针对此版本重建,一切都会好起来的。 Uri 规范化是以前所有版本的 .net 的一个类似功能的错误,我很幸运,我刚刚遇到它......

关于c# - NUnit 下无效的 System.Uri 解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25968963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com