我有一个包含streamWriter.WriteLineAsync(outputLine)
代码部分如下所示:
using (StreamWriter streamWriter = new StreamWriter(outputFilePath))
{
using (StreamReader streamReader = new StreamReader(filePath))
{
string name = string.Empty;
while ((name = streamReader.ReadLine()) != null)
{
var result = this.entitySatoriIDAccessor.GetEntityAndSatoriId(name);
foreach (Tuple<string, string, string, double> tuple in result)
{
string outputLine = string.Format(
"{0}, {1}, {2}, {3}",
tuple.Item1,
tuple.Item2,
tuple.Item3,
tuple.Item4);
streamWriter.WriteLineAsync(outputLine);
}
}
}
}
单元测试可以通过VS的“运行选定测试”运行,但如果我选择"Analyze Code Coverage For Selected Tests"
,则测试将失败,并显示错误消息"The stream is currently in use by a previous operation on the stream"
。我想知道为什么会发生这种情况,在VS中使用Analyze Code Coverage进行任何特殊设置?