-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Expand file tree
/
Copy pathLinuxSettingsTests.cs
More file actions
47 lines (38 loc) · 1.43 KB
/
LinuxSettingsTests.cs
File metadata and controls
47 lines (38 loc) · 1.43 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
using System.Collections.Generic;
using GitCredentialManager.Interop.Linux;
using GitCredentialManager.Tests.Objects;
using Xunit;
namespace GitCredentialManager.Tests.Interop.Linux;
public class LinuxSettingsTests
{
[LinuxFact]
public void LinuxSettings_TryGetExternalDefault_CombinesFiles()
{
var env = new TestEnvironment();
var git = new TestGit();
var trace = new NullTrace();
var fs = new TestFileSystem();
var utf8 = EncodingEx.UTF8NoBom;
fs.Directories = new HashSet<string>
{
"/",
"/etc",
"/etc/git-credential-manager",
"/etc/git-credential-manager/config.d"
};
const string config1 = "core.overrideMe=value1";
const string config2 = "core.overrideMe=value2";
const string config3 = "core.overrideMe=value3";
fs.Files = new Dictionary<string, byte[]>
{
["/etc/git-credential-manager/config.d/01-first"] = utf8.GetBytes(config1),
["/etc/git-credential-manager/config.d/02-second"] = utf8.GetBytes(config2),
["/etc/git-credential-manager/config.d/03-third"] = utf8.GetBytes(config3),
};
var settings = new LinuxSettings(env, git, trace, fs);
bool result = settings.TryGetExternalDefault(
"core", null, "overrideMe", out string value);
Assert.True(result);
Assert.Equal("value3", value);
}
}