-
Notifications
You must be signed in to change notification settings - Fork 366
Expand file tree
/
Copy pathConfigTests.cs
More file actions
54 lines (47 loc) · 1.75 KB
/
ConfigTests.cs
File metadata and controls
54 lines (47 loc) · 1.75 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
53
54
using Should;
using Xunit.Extensions;
namespace ScriptCs.Tests
{
using ScriptCs.Contracts;
using Xunit;
public class ConfigTests
{
public class TheApplyMethod
{
[Theory]
[InlineData(true, null, LogLevel.Error, LogLevel.Debug)]
[InlineData(false, null, LogLevel.Error, LogLevel.Error)]
[InlineData(true, LogLevel.Error, LogLevel.Trace, LogLevel.Error)]
[InlineData(true, null, LogLevel.Trace, LogLevel.Trace)]
public void CalculatesTheLogLevel(
bool debug, LogLevel? logLevel, LogLevel currentLogLevel, LogLevel expectedLogLevel)
{
// arrange
var mask = new ConfigMask { Debug = debug, LogLevel = logLevel };
var config = new Config { LogLevel = currentLogLevel };
// act
config = config.Apply(mask);
// assert
config.LogLevel.ShouldEqual(expectedLogLevel);
}
[Theory]
[InlineData(null, null)]
[InlineData(".csx", ".csx")]
[InlineData(".fsx", ".fsx")]
[InlineData("a", "a.csx")] // :eyes: here it is!
[InlineData("a.", "a.")]
[InlineData("a.csx", "a.csx")]
[InlineData("a.fsx", "a.fsx")]
public void AddsTheDefaultExtension(string scriptName, string expectedScriptName)
{
// arrange
var mask = new ConfigMask { ScriptName = scriptName };
var config = new Config();
// act
config = config.Apply(mask);
// assert
config.ScriptName.ShouldEqual(expectedScriptName);
}
}
}
}