public void SectionExistsTrue() { using (var tester = new IniFileTester(ValidSection1)) { Assert.IsTrue(tester.TestFile.SectionExists("section")); } }
public void SectionExistsFalse() { using (var tester = new IniFileTester(ValidSection1)) { Assert.IsFalse(tester.TestFile.SectionExists("blah")); } }
public void SectionExistsFalse() { using (var tester = new IniFileTester(ValidSection1)) { Assert.IsFalse(tester.TestFile.SectionExists("blah")); } }
public void SectionExistsTrue() { using (var tester = new IniFileTester(ValidSection1)) { Assert.IsTrue(tester.TestFile.SectionExists("section")); } }
public void TryGetSection() { using (var tester = new IniFileTester(ValidSection1)) { tester.AssertSection("section", "property", "value"); } }
public void TryGetSection() { using (var tester = new IniFileTester(ValidSection1)) { tester.AssertSection("section", "property", "value"); } }
public void TryGetSectionDuplicatePropertyRegex() { using (var tester = new IniFileTester(DuplicatePropertySection)) { Dictionary <string, string> properties; Assert.IsFalse(tester.TestFile.TryGetSection(new Regex("ectio"), out properties)); } }
public void ReadInvalid() { AssertExtensions.ExpectException(() => { using(var tester = new IniFileTester(InvalidIniFile)) { } }, typeof(InvalidDataException), new Regex(String.Format(ErrorFormat, 1, Regex.Escape(InvalidIniFile)))); }
public void ReadInvalid() { AssertExtensions.ExpectException(() => { using (var tester = new IniFileTester(InvalidIniFile)) { } }, typeof(InvalidDataException), new Regex(String.Format(ErrorFormat, 1, Regex.Escape(InvalidIniFile)))); }
public void TryGetSectionCommentsAreNotProperties() { using (var tester = new IniFileTester(DuplicateCommentPropertySection)) { Dictionary <string, string> properties; Assert.IsTrue(tester.TestFile.TryGetSection("section", out properties)); Assert.AreEqual(0, properties.Count); } }
public void DeleteSection() { using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.DeleteSection("section"); Assert.IsFalse(tester.TestFile.SectionExists("section")); tester.TestFile.Persist(); tester.AssertFileContents(String.Empty); } }
public void EnsureSectionExists_New() { using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EnsureSectionExists("section2"); tester.AssertSection("section2"); tester.TestFile.Persist(); tester.AssertFileContents(ValidSection1 + "[section2]"); } }
public void EnsureSectionExists_AlreadyExists() { using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EnsureSectionExists("section"); tester.AssertSection("section", "property", "value"); tester.TestFile.Persist(); tester.AssertFileContents(ValidSection1); } }
public void DeleteSection_Middle() { using (var tester = new IniFileTester(ValidSection1 + ValidSection2 + ValidSection3)) { tester.TestFile.DeleteSection("section2"); Assert.IsFalse(tester.TestFile.SectionExists("section2")); tester.TestFile.Persist(); tester.AssertFileContents(ValidSection1 + ValidSection3); } }
public void EditProperty() { var properties = new List <KeyValuePair <string, string> >(); properties.Add(new KeyValuePair <string, string>("property", "value2")); using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EditSection("section", properties); tester.AssertSection("section", "property", "value2"); tester.TestFile.Persist(); tester.AssertFileContents("[section]" + Environment.NewLine + "property=value2"); } }
public void DeleteProperty() { var properties = new SortedDictionary <string, string>(); properties.Add("property", null); using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EditSection("section", properties); tester.AssertSection("section"); tester.TestFile.Persist(); tester.AssertFileContents("[section]" + Environment.NewLine); } }
public void AddProperty() { var properties = new SortedDictionary <string, string>(); properties.Add("property", "value"); properties.Add("property2", "value2"); using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EditSection("section", properties); tester.AssertSection("section", "property", "value", "property2", "value2"); tester.TestFile.Persist(); tester.AssertFileContents(ValidSection1 + "property2=value2"); } }
public void AddAndEditProperties() { var properties = new SortedDictionary <string, string>(); properties.Add("property", "value3"); properties.Add("property2", "value2"); using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EditSection("section", properties); tester.AssertSection("section", "property", "value3", "property2", "value2"); tester.TestFile.Persist(); tester.AssertFileContents("[section]" + Environment.NewLine + "property=value3" + Environment.NewLine + "property2=value2"); } }
public void EnsureSectionExists_AlreadyExists() { using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EnsureSectionExists("section"); tester.AssertSection("section", "property", "value"); tester.TestFile.Persist(); tester.AssertFileContents(ValidSection1); } }
public void EnsureSectionExists_New() { using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EnsureSectionExists("section2"); tester.AssertSection("section2"); tester.TestFile.Persist(); tester.AssertFileContents(ValidSection1 + "[section2]"); } }
public void AddProperty() { var properties = new List<KeyValuePair<string, string>>(); properties.Add(new KeyValuePair<string, string>("property2", "value2")); using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EditSection("section", properties); tester.AssertSection("section", "property", "value", "property2", "value2"); tester.TestFile.Persist(); tester.AssertFileContents(ValidSection1 + "property2=value2"); } }
public void AddAndEditProperties() { var properties = new List<KeyValuePair<string, string>>(); properties.Add(new KeyValuePair<string, string>("property", "value3")); properties.Add(new KeyValuePair<string, string>("property2", "value2")); using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EditSection("section", properties); tester.AssertSection("section", "property", "value3", "property2", "value2"); tester.TestFile.Persist(); tester.AssertFileContents("[section]" + Environment.NewLine + "property=value3" + Environment.NewLine + "property2=value2"); } }
public void DeleteProperty() { var properties = new List<KeyValuePair<string, string>>(); properties.Add(new KeyValuePair<string, string>("property", null)); using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.EditSection("section", properties); tester.AssertSection("section"); tester.TestFile.Persist(); tester.AssertFileContents("[section]" + Environment.NewLine); } }
public void DeleteSection_Middle() { using (var tester = new IniFileTester(ValidSection1 + ValidSection2 + ValidSection3)) { tester.TestFile.DeleteSection("section2"); Assert.IsFalse(tester.TestFile.SectionExists("section2")); tester.TestFile.Persist(); tester.AssertFileContents(ValidSection1 + ValidSection3); } }
public void DeleteSection() { using (var tester = new IniFileTester(ValidSection1)) { tester.TestFile.DeleteSection("section"); Assert.IsFalse(tester.TestFile.SectionExists("section")); tester.TestFile.Persist(); tester.AssertFileContents(String.Empty); } }