コード例 #1
0
            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));
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            public void SetsTheSplunkRCPathToTheProvidedPath(IFileSystem fileSystem)
            {
                var loader = new SplunkConfigLoader(fileSystem, @"c:\test");

                loader.SplunkRCPath.ShouldEqual(@"c:\test");
            }
コード例 #4
0
 public void SetsTheSplunkRCPathToTheHomeDirectoryWhenNoPathIsProvided(SplunkConfigLoader loader)
 {
     loader.SplunkRCPath.ShouldEqual(Path.Combine(
                                         Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".splunkrc"));
 }
コード例 #5
0
        public void LoadConfig(string splunkRCPath = null)
        {
            var loader = new SplunkConfigLoader(_fileSystem, splunkRCPath);

            loader.Load(Config);
        }