Splunk.Client.Helpers.SplunkConfigLoader.Load C# (CSharp) Method

Load() public method

public Load ( SplunkConfig config ) : void
config SplunkConfig
return void
        public void Load(SplunkConfig config)
        {
            if (!_fileSystem.FileExists(SplunkRCPath))
            {
                throw new FileNotFoundException(".splunkrc file not found", SplunkRCPath);
            }

            var lines = _fileSystem.ReadFileLines(SplunkRCPath);
            GetSettings(lines, config);
        }

Usage Example

 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;
 }
All Usage Examples Of Splunk.Client.Helpers.SplunkConfigLoader::Load