forked from scriptcs/scriptcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfiguration.cs
More file actions
52 lines (42 loc) · 1.94 KB
/
Configuration.cs
File metadata and controls
52 lines (42 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
namespace ScriptCs.Tests.Acceptance
{
using System.Reflection;
using ScriptCs.Tests.Acceptance.Support;
using Should;
using Xbehave;
public static class Configuration
{
[Scenario]
public static void LocalConfiguration(ScenarioDirectory directory, string output)
{
var scenario = MethodBase.GetCurrentMethod().GetFullName();
"Given a hello world script"
.x(() => directory = ScenarioDirectory.Create(scenario)
.WriteLine("foo.csx", @"Console.WriteLine(""Hello world!"");"));
"And a local config file specfying the log level as debug"
.x(() => directory.WriteLine("scriptcs.opts", @"{ logLevel: ""debug"" }"));
"When I execute the script without the log level option"
.x(() => output = ScriptCsExe.Run("foo.csx", false, directory));
"Then I see debug messages"
.x(() => output.ShouldContain("DEBUG:"));
}
[Scenario]
public static void CustomConfiguration(ScenarioDirectory directory, string output)
{
var scenario = MethodBase.GetCurrentMethod().GetFullName();
"Given a hello world script"
.x(() => directory = ScenarioDirectory.Create(scenario)
.WriteLine("foo.csx", @"Console.WriteLine(""Hello world!"");"));
"And a local config file specfying to run as debug"
.x(() => directory.WriteLine("custom.opts", @"{ logLevel: ""debug"" }"));
"When I execute the script without the log level option but specifying the custom config"
.x(() =>
{
var args = new[] { "--config", "custom.opts", };
output = ScriptCsExe.Run("foo.csx", false, args, directory);
});
"Then I see debug messages"
.x(() => output.ShouldContain("DEBUG:"));
}
}
}