我编写了代码,其中我给出了文件路径和预期结果。但是如何更改var Path
以便我输入多个文件名并期望var expected
中有多个输出。
[Then(@"Transfer measure should be generated for (.*)")]
public void ValidateMeasurement(string lifecyclestatus)
{
var Path = "irm_pww_xxx_xxx.csv.ovr";
const string processFilePath = "/orabin/app//ff/actuals/";
var actual = Common.LinuxCommandExecutor
.RunLinuxcommand($"cat {processFilePath} {Path}");
var expected = "6677,6677_6677,3001,6";
Assert.AreEqual(expected, actual);
}
答案 0 :(得分:2)
.RunLinuxcommand($"cat {processFilePath}/* {Path}");
应该做的伎俩。将通配符放入路径名在UNIX衍生产品中称为 globbing 。它很方便,因为它按词汇顺序对它匹配的文件名进行排序,因此您总是以相同的顺序获得相同的文件集。
但是.../*
有点滥交,它会占用该目录中的所有文件。
.RunLinuxcommand($"cat {processFilePath}/*.tstout {Path}");
或您希望收集的文件的一些适当扩展名。
您可以通过说echo whatever/*.whatever
来测试通配,然后您将看到文件名。