[英]Location of the script file in ScriptCS
Okay, so you can access that using Env.ScriptPath
from inside your CSX script. 好的,因此您可以从CSX脚本内部使用
Env.ScriptPath
进行访问。
The test below shows that in action, and can be found here . 下面的测试表明了它的实际作用,可以在此处找到。
[Scenario]
public static void ScriptPathIsSet(ScenarioDirectory directory, string output)
{
var scenario = MethodBase.GetCurrentMethod().GetFullName();
"Given a script which accesses Env.ScriptPath"
.f(() => directory = ScenarioDirectory.Create(scenario)
.WriteLine("foo.csx", "Console.WriteLine(Env.ScriptPath)"));
"When I execute the script"
.f(() => output = ScriptCsExe.Run("foo.csx", directory));
"Then the ScriptPath is displayed"
.f(() => output.ShouldContain("foo.csx"));
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.