C#如何强制本地化文化在美国进行测试项目 [英] C# How can I force Localization Culture to en-US for tests project

查看:72
本文介绍了C#如何强制本地化文化在美国进行测试项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在VS2008中的C#中为测试项目指定一致的本地化文化?我正在构建具有在web.config中指定的非标准区域性的Asp .Net MVC应用程序,但是如何为该项目的单元测试设置相同的区域性?

How to specify concrente Localization Culture for tests project in C# in VS2008? I'm building Asp .Net MVC app that has nonstandard culture specified in web.config but how to set the same culture for unit tests for that project?

推荐答案

您可以设置

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); 

在单元测试框架中标记为测试初始化​​程序"的方法中.

in method that is marked as "test initializer" in your unit testing framework.

这篇关于C#如何强制本地化文化在美国进行测试项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆