Mercurial > repos > IBBoard.Ini.Tests
diff IniSectionTest.cs @ 9:eac501db18e7
Re #11 - Add getter methods to IniFile and IniSection
* Add mock classes for IniFile and IniSection
* Add tests for new getter methods
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 21 Feb 2009 10:57:23 +0000 |
parents | 4f281289bcdd |
children | 62221475c572 |
line wrap: on
line diff
--- a/IniSectionTest.cs Tue Feb 17 15:28:21 2009 +0000 +++ b/IniSectionTest.cs Sat Feb 21 10:57:23 2009 +0000 @@ -46,5 +46,33 @@ line = new IniKeyValuePairLine("something", "different"); section.AddIniLine(line); } + + [Test()] + public void TestGettingLineValueOnNonExistantLineReturnsNull() + { + IniSection section = new MockIniSectionWithOneLine(); + Assert.IsNull(section.GetLineValue("b")); + } + + [Test()] + public void TestGettingSectionLineValueOnLineInSectionReturnsValue() + { + IniSection section = new MockIniSectionWithOneLine(); + Assert.AreEqual(MockIniSectionWithOneLine.VALUE, section.GetLineValue(MockIniSectionWithOneLine.KEY_NAME)); + } + + [Test()] + public void TestGettingSectionLineValueOnNonExistantLineInSectionReturnsDefaultValue() + { + IniSection section = new MockIniSectionWithOneLine(); + Assert.AreEqual("default-value", section.GetLineValue("b", "default-value")); + } + + [Test()] + public void TestGettingSectionLineValueOnLineInSectionDoesNotReturnDefault() + { + IniSection section = new MockIniSectionWithOneLine(); + Assert.AreEqual(MockIniSectionWithOneLine.VALUE, section.GetLineValue(MockIniSectionWithOneLine.KEY_NAME, "default-value")); + } } }