NUnit,针对多种文化进行测试

编程入门 行业动态 更新时间:2024-10-16 20:23:26
本文介绍了NUnit,针对多种文化进行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我希望使用 NUnit 在某个项目中针对多种文化运行所有测试.

Using NUnit I wish to run all the tests in a certain project against multiple cultures.

该项目处理应该是文化中性的解析数据,以确保这一点,我想针对多种文化运行每个测试.

The project deals with parsing data that should be culture neutral, to ensure this I would like to run every test against multiple cultures.

我目前的解决方案是

public abstract class FooTests { /* tests go here */ } [TestFixture, SetCulture ("en-GB")] public class FooTestsEN : FooTests {} [TestFixture, SetCulture ("pl-PL")] public class FooTestsPL : FooTests {}

理想情况下,我不应该创建这些类,而是使用类似的东西:

Ideally, I shouldn't have to create these classes and instead use something like:

[assembly: SetCulture ("en-GB")] [assembly: SetCulture ("pl-PL")]

推荐答案

很遗憾,现在无法实现,但计划在未来进行.

Unfortunatelly this isn't possible now but is planned for future.

你也可以这样做.

public class AllCultureTests { private TestSomething() {...} [Test] [SetCulture("pl-PL")] public void ShouldDoSomethingInPoland() { TestSomething(); } }

也许这是您更喜欢的?

更多推荐

NUnit,针对多种文化进行测试

本文发布于:2023-11-06 23:57:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565009.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进行测试   多种   文化   NUnit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!