Visual Studio测试资源管理器以外语运行测试(Visual Studio test explorer runs tests in foreign language)
我已经创建了C#单元测试(使用VS测试工具)。 其中,有测试检查例外情况:
Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
当我打开单元测试文件并单击上下文菜单中的“运行测试”时,一切正常。 当我使用Visual Studio的测试资源管理器并单击“运行测试”时,我得到异常消息,说明异常消息不同。 实际上,它与我正在检查的那个相同,但是用另一种语言。 在这两种情况下运行的测试是相同的,没有语言更改或其他任何东西,只是简单的逻辑测试。 我的操作系统也是英文版,Visual Studio也是。 我在另一个解决方案中有类似的测试,一切正常。 这个解决方案和我正在编写单元测试的项目之一是由一个拥有该外语系统的同事创建的。 但是,我无法在任何地方找到类似的设置。 有人知道这些可能在哪里吗? 如何让测试始终以英语运行?
I have created C# unit tests (using VS test tools). Among others, there are tests checking exceptions like that:
Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
When I open my unit test file and click "Run tests" in the context menu, everything works fine. When I use the test explorer of Visual Studio and click "Run tests" there, I get exceptions saying that the message of the exception is different. Actually, it is the same as the one I am checking for but in another language. The tests running in both cases are the same, there are no language changes or anything else, just simple logic tests. My OS is in English, Visual Studio as well. I have similar tests in another solution and there everything works fine. This solution and one of the projects that I am writing unit tests for were created by a colleague which has the system in this foreign language. However, I can't find settings like that anywhere. Does someone have an idea where these could be? How do I get the tests running always in English?
原文:https://stackoverflow.com/questions/36838186
最满意答案
你几乎拥有它。 您需要垂直连接逗号分隔列表
r{:}
,而不是水平连接。 所以,使用cellstr(vertcat(r{:}))
You almost have it. You need to concatenate the comma-separeted list
r{:}
vertically, not horizontally. So, usecellstr(vertcat(r{:}))
相关问答
更多-
我不认为你想做的事情可以用细胞完成,没有循环或者是cellfun ,就是这样。 单元格是异构数据结构,不能保证每个元素都具有兼容的形状。 哎呀,您的单元格中的元素编号3甚至可以是另一个单元格,字符串或自定义类实例! 我只是说我发现细胞无法以你想要的方式编入索引并不令人惊讶。 但是,您可以将您的单元格设置为更高维的数组,并使用它: VsMat = cat(3,VsCell{:}); % cell as comma separated list MatMeans = mean(VsMat,3); % mean ...
-
你在找这样的东西吗? fileNames = cellfun(@(idx) fullfile(fileFolder,idx),{dirOutput.name}','uni',0) Are you looking for something like this? fileNames = cellfun(@(idx) fullfile(fileFolder,idx),{dirOutput.name}','uni',0)
-
将xnames括在大括号中以将其保留为单元格数组: r = struct( 'a', a, 'b', b, 'x', {xnames} ) ; Enclose xnames in braces to keep it as a cell array: r = struct( 'a', a, 'b', b, 'x', {xnames} ) ;
-
matlab将每个char元素更改为单元格数组中的单元格类型(matlab change each char element to cell type in a cell array)[2023-12-01]
你几乎拥有它。 您需要垂直连接逗号分隔列表r{:} ,而不是水平连接。 所以,使用 cellstr(vertcat(r{:})) You almost have it. You need to concatenate the comma-separeted list r{:} vertically, not horizontally. So, use cellstr(vertcat(r{:})) -
您可以使用函数cellstr执行此操作,如Divakar所建议的那样。 A = ['hello' 'hillo' 'hello'] C = cellstr(A) C = 'hello' 'hillo' 'hello' You can use the function cellstr to do this, as proposed by Divakar. A = ['hello' 'hillo' 'hello'] C = cell ...
-
这是我的回答,受到excaza评论的启发 perms(cell) This is my answer inspired by excaza's comment perms(cell)
-
当你想将数组拆分为相同大小的部分时,使用num2cell函数将数组转换为单元格。 grade = 'FFDBA'; num2cell(grade,size(grade)) ans = 'F' 'F' 'D' 'B' 'A' Use the num2cell function to convert an array to a cell, when you want to split the array into same-size parts. grade = 'FFDB ...
-
你必须使用圆括号而不是花括号(它们作用于内部单元格值,而不是单元格本身): A(end) = []; 有关更多详细信息,请参阅您链接的官方文档的最后一部分: https://mathworks.com/help/matlab/matlab_prog/delete-data-from-a-cell-array.html You have to use round parentheses instead of curly braces (which act on the inner cell values a ...
-
MATLAB:如何检查单元格数组中是否已存在单元格元素?(MATLAB:How to check if a cell element already exists in a cell array?)[2022-11-29]
我假设“元素”是指整个向量。 例如,给定 Q = {[1 2 3], [4 5]} 应该添加新的载体[2 4 3] ,但[4 5]不应该。 要做那个检查:用new表示新的向量,使用 alreadyExists = any(cellfun(@(x) isequal(x, new), Q)); 例子: >> Q = {[1 2 3], [4 5]}; >> alreadyExists = any(cellfun(@(x) isequal(x, [2 4 3]), Q)) alreadyExists = ... -
有一些可选的参数find让你只获得前N个结果。 我没有证实这会导致短路评估; 这取决于MATLAB的JIT编译器是否根据需要重新排序操作。 i = find(ismember(A,B), 1, 'first'); 从文档 : nd = find(X, k)或ind = find(X, k, 'first')最多返回对应于X的非零项的前k索引。 k必须是正整数,但它可以是任何数字数据类型。 您当前的解决方法看起来既直截了当又保证具有所需的复杂性。 There are some optional argume ...