forked from SharpGenTools/SharpGenTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigFileTests.cs
More file actions
66 lines (52 loc) · 1.52 KB
/
Copy pathConfigFileTests.cs
File metadata and controls
66 lines (52 loc) · 1.52 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
55
56
57
58
59
60
61
62
63
64
65
66
using SharpGen.Config;
using Xunit;
using Xunit.Abstractions;
namespace SharpGen.UnitTests;
public class ConfigFileTests : TestBase
{
public ConfigFileTests(ITestOutputHelper outputHelper) : base(outputHelper)
{
}
[Fact]
public void VariableSubstitutionSubstitutesVariableValues()
{
var config = new ConfigFile
{
IncludeDirs =
{
new IncludeDirRule("$(TEST_VARIABLE)")
}
};
config.Variables.Add(new KeyValue("TEST_VARIABLE", "Hello World!"));
config.ExpandVariables(false, Logger);
Assert.Equal("Hello World!", config.IncludeDirs[0].Path);
}
[Fact]
public void DynamicVariablesNotSubstitutedWhenExpandIsFalse()
{
var config = new ConfigFile
{
IncludeDirs =
{
new IncludeDirRule("#(TEST_VARIABLE)")
}
};
config.DynamicVariables.Add("TEST_VARIABLE", "Hello World!");
config.ExpandVariables(false, Logger);
Assert.Equal("#(TEST_VARIABLE)", config.IncludeDirs[0].Path);
}
[Fact]
public void DynamicVariablesSubstitutedWhenExpandIsTrue()
{
var config = new ConfigFile
{
IncludeDirs =
{
new IncludeDirRule("#(TEST_VARIABLE)")
}
};
config.DynamicVariables.Add("TEST_VARIABLE", "Hello World!");
config.ExpandVariables(true, Logger);
Assert.Equal("Hello World!", config.IncludeDirs[0].Path);
}
}