public void LoadConfig(string splunkRCPath = null) { var loader = new SplunkConfigLoader(_fileSystem, splunkRCPath); loader.Load(Config); }
private SplunkConfig LoadTestConfig(Mock<IFileSystem> mockFileSystem) { var config = new SplunkConfig(); mockFileSystem.Setup(fs => fs.FileExists(It.IsAny<string>())).Returns(true); mockFileSystem.Setup(fs => fs.ReadFileLines(It.IsAny<string>())).Returns(TestConfigLoader.GetSplunkRC()); var loader = new SplunkConfigLoader(mockFileSystem.Object); loader.Load(config); return config; }
public void SetsTheSplunkRCPathToTheHomeDirectoryWhenNoPathIsProvided(SplunkConfigLoader loader) { loader.SplunkRCPath.ShouldEqual(Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".splunkrc")); }
public void ThrowsAnExceptionIfTheFileDoesNotExist(Mock<IFileSystem> mockFileSystem, SplunkConfig config) { mockFileSystem.Setup(f => f.FileExists(It.IsAny<string>())).Returns(false); var loader = new SplunkConfigLoader(mockFileSystem.Object, "test"); Assert.Throws<FileNotFoundException>(() => loader.Load(config)); }
public void SetsTheSplunkRCPathToTheProvidedPath(IFileSystem fileSystem) { var loader = new SplunkConfigLoader(fileSystem, @"c:\test"); loader.SplunkRCPath.ShouldEqual(@"c:\test"); }