本文介绍了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,针对多种文化进行测试
发布评论