如何从 fileincludes 创建连接字符串
How do I create a joined string from fileincludes
我正在使用 FAKE 作为构建工具,但我必须承认我对 F#
和函数式编程
还很陌生
为了 运行我的测试,我使用了以下有效的代码:
trace "BuildTests..."
!! "Tests/**.Tests/*.csproj"
|> Seq.iter (fun p ->
[p]
|> MSBuildDebug (testDir @@ Path.GetFileNameWithoutExtension(p)) "Build"
|> Log "TestBuild-Output: "
)
trace "RunTests..."
!! (testDir + "**/*.Tests.dll")
|> MSTest (fun p ->
{ p with
TestSettingsPath = testSettingsPath
ResultsDir = artifactsDir
ErrorLevel = ErrorLevel.DontFailBuild })
但现在我想使用 OpenCover
而不是 MSTest 来 运行 我的测试。基本上对 OpenCover 的调用是
OpenCover (fun p ->
{ p with
Output=(artifactsDir + "output.xml")
OptionalArguments = "-excludebyfile:*Designer.* -returntargetcode" })
"/testcontainer:Path.To.First.Test.dll /testcontainer:Path.To.Second.Test.dll"
所以我的问题是如何将 !! (testDir + "**/*.Tests.dll")
之类的 FileInclude 结果转换为组合字符串
/testcontainer:file1.dll /testcontainer:file2.dll /testcontainer:file3.dll
所以我可以将它与 OpenCover 任务一起使用
与您的相似
!! "Tests/**.Tests/*.csproj"
|> Seq.iter (fun p ->
将序列转换为数组并连接它。
!! (testDir + "**/*.Tests.dll")
|> Seq.toArray
|> String.concat " "
我正在使用 FAKE 作为构建工具,但我必须承认我对 F#
和函数式编程
为了 运行我的测试,我使用了以下有效的代码:
trace "BuildTests..."
!! "Tests/**.Tests/*.csproj"
|> Seq.iter (fun p ->
[p]
|> MSBuildDebug (testDir @@ Path.GetFileNameWithoutExtension(p)) "Build"
|> Log "TestBuild-Output: "
)
trace "RunTests..."
!! (testDir + "**/*.Tests.dll")
|> MSTest (fun p ->
{ p with
TestSettingsPath = testSettingsPath
ResultsDir = artifactsDir
ErrorLevel = ErrorLevel.DontFailBuild })
但现在我想使用 OpenCover
而不是 MSTest 来 运行 我的测试。基本上对 OpenCover 的调用是
OpenCover (fun p ->
{ p with
Output=(artifactsDir + "output.xml")
OptionalArguments = "-excludebyfile:*Designer.* -returntargetcode" })
"/testcontainer:Path.To.First.Test.dll /testcontainer:Path.To.Second.Test.dll"
所以我的问题是如何将 !! (testDir + "**/*.Tests.dll")
之类的 FileInclude 结果转换为组合字符串
/testcontainer:file1.dll /testcontainer:file2.dll /testcontainer:file3.dll
所以我可以将它与 OpenCover 任务一起使用
与您的相似
!! "Tests/**.Tests/*.csproj"
|> Seq.iter (fun p ->
将序列转换为数组并连接它。
!! (testDir + "**/*.Tests.dll")
|> Seq.toArray
|> String.concat " "