public void IgnoreCommentLine() { // Arrange var contents = @"#"; var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents)); stream.Seek(0, SeekOrigin.Begin); var parser = new ConfigParser(); // Act var config = parser.Parse(stream); // Assert Assert.AreEqual(0, config.Count); }
public void ParserParsesSimpleKeyValue() { // Arrange var contents = "Key Value"; var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents)); stream.Seek(0, SeekOrigin.Begin); var parser = new ConfigParser(); // Act var config = parser.Parse(stream); // Assert Assert.True(config.ContainsKey("Key")); Assert.AreEqual(config["Key"], "Value"); }
public void LoadPluginAddsPluginNameToPluginsList() { // Arrange var contents = "LoadPlugin cpu"; var stream = new MemoryStream(Encoding.UTF8.GetBytes(contents)); stream.Seek(0, SeekOrigin.Begin); var parser = new ConfigParser(); // Act var config = parser.Parse(stream); // Assert Assert.AreEqual(1, config.Plugins.Count); Assert.True(config.Plugins.Contains("cpu")); }
private ConfigurationFile LoadConfig() { var parser = new ConfigParser(); var config = parser.Parse("collectn.conf"); return config; }