comparison 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
comparison
equal deleted inserted replaced
8:7b039f226032 9:eac501db18e7
44 IniKeyValuePairLine line = new IniKeyValuePairLine("something", "value"); 44 IniKeyValuePairLine line = new IniKeyValuePairLine("something", "value");
45 section.AddIniLine(line); 45 section.AddIniLine(line);
46 line = new IniKeyValuePairLine("something", "different"); 46 line = new IniKeyValuePairLine("something", "different");
47 section.AddIniLine(line); 47 section.AddIniLine(line);
48 } 48 }
49
50 [Test()]
51 public void TestGettingLineValueOnNonExistantLineReturnsNull()
52 {
53 IniSection section = new MockIniSectionWithOneLine();
54 Assert.IsNull(section.GetLineValue("b"));
55 }
56
57 [Test()]
58 public void TestGettingSectionLineValueOnLineInSectionReturnsValue()
59 {
60 IniSection section = new MockIniSectionWithOneLine();
61 Assert.AreEqual(MockIniSectionWithOneLine.VALUE, section.GetLineValue(MockIniSectionWithOneLine.KEY_NAME));
62 }
63
64 [Test()]
65 public void TestGettingSectionLineValueOnNonExistantLineInSectionReturnsDefaultValue()
66 {
67 IniSection section = new MockIniSectionWithOneLine();
68 Assert.AreEqual("default-value", section.GetLineValue("b", "default-value"));
69 }
70
71 [Test()]
72 public void TestGettingSectionLineValueOnLineInSectionDoesNotReturnDefault()
73 {
74 IniSection section = new MockIniSectionWithOneLine();
75 Assert.AreEqual(MockIniSectionWithOneLine.VALUE, section.GetLineValue(MockIniSectionWithOneLine.KEY_NAME, "default-value"));
76 }
49 } 77 }
50 } 78 }