如何从fileincludes创建连接字符串

时间:2015-12-03 13:43:03

标签: .net f# f#-fake

我使用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任务一起使用

1 个答案:

答案 0 :(得分:5)

与您的

类似
!! "Tests/**.Tests/*.csproj"
|> Seq.iter (fun p ->

将Seqeuence转换为数组并将其连接起来。

!! (testDir + "**/*.Tests.dll") 
|> Seq.toArray 
|> String.concat " "
相关问题