Unit testing 本地化测试从命令行失败,但在VS中成功运行
我有以下方法:Unit testing 本地化测试从命令行失败,但在VS中成功运行,unit-testing,localization,mstest,Unit Testing,Localization,Mstest,我有以下方法: [TestMethod] public void Message_TestToEnglishString() { // Set the thread to French to get the French resource Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr"); string fre
[TestMethod]
public void Message_TestToEnglishString()
{
// Set the thread to French to get the French resource
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr");
string frenchMessageBase = MessagesResources.USER_LOGGED_IN;
Assert.AreNotEqual("{0} logged in.", frenchMessageBase);
}
这完全符合VisualStudio中的预期。命令行中相同代码上的相同测试运行失败,因为该值是从“{0}登录的英文资源文件中提取的。”
关于为什么会发生这种情况,以及如何解决它,有什么见解吗
如果我设置资源文件区域性,也就是说,
MessagesResources.Culture
但是稍后会有其他测试直接调用资源文件。尝试设置Threading.Thread.CurrentThread.CurrentCulture从应用程序的命令行版本访问资源的方式是否与从Visual Studio访问资源的方式相同
可能是路径问题,与此类似:?