public void GitConfiguration_GetString_Name_DoesNotExists_ThrowsException() { string repoPath = CreateRepository(); string gitPath = GetGitPath(); var trace = new NullTrace(); var git = new GitProcess(trace, gitPath, repoPath); IGitConfiguration config = git.GetConfiguration(); string randomName = $"{Guid.NewGuid():N}.{Guid.NewGuid():N}"; Assert.Throws <KeyNotFoundException>(() => config.GetValue(randomName)); }
public void GitConfiguration_GetString_SectionProperty_DoesNotExists_ThrowsException() { string repoPath = CreateRepository(); string gitPath = GetGitPath(); var trace = new NullTrace(); var git = new GitProcess(trace, gitPath, repoPath); IGitConfiguration config = git.GetConfiguration(); string randomSection = Guid.NewGuid().ToString("N"); string randomProperty = Guid.NewGuid().ToString("N"); Assert.Throws <KeyNotFoundException>(() => config.GetValue(randomSection, randomProperty)); }
public void GitConfiguration_GetString_SectionScopeProperty_NullScope_ReturnsUnscopedString() { string repoPath = CreateRepository(out string workDirPath); Git(repoPath, workDirPath, "config --local user.name john.doe").AssertSuccess(); string gitPath = GetGitPath(); var trace = new NullTrace(); var git = new GitProcess(trace, gitPath, repoPath); IGitConfiguration config = git.GetConfiguration(); string value = config.GetValue("user", null, "name"); Assert.NotNull(value); Assert.Equal("john.doe", value); }