我有一个函数,它返回文本文件路径和文件内容:
public static Tuple<string, string> OpenTextFile()
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog .Filter = "Text |*.txt";
bool? accept = openFileDialog.ShowDialog();
if (accept == true)
return Tuple.Create(File.ReadAllText(openFileDialog.FileName, Encoding.UTF8), openFileDialog.FileName);
else
return null;
}
Run Code Online (Sandbox Code Playgroud)
如何单元测试文件读取?是否可以测试对话框显示?
我无法构建我的解决方案,我在输出中得到了这个:
Build started ...
Build Failure. Error: Invalid Configuration
Parameter name: configurationName
========== Build: 0 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Run Code Online (Sandbox Code Playgroud)
但是,如果我逐个构建项目(没有所有解决方案),没关系,Configuration Manager也可以.在我看来,答案很简单,但我不知道如何解决它.
例如,我有如下字符串:
"5","8","14","260"
我希望得到如下结果:
"ST00000005","ST00000008","ST00000014","ST00000260"
结果字符串长度为10个字符.我该怎么做?