Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 本地化测试从命令行失败,但在VS中成功运行_Unit Testing_Localization_Mstest - Fatal编程技术网

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访问资源的方式相同


可能是路径问题,与此类似:?