Mercurial > repos > IBBoard.Ini.Tests
annotate IniFileReaderTest.cs @ 6:4f281289bcdd
Re #8 - License code
* Specify version of LGPL in headers
* Add COPYING.GPL and COPYING.LGPL in to project with license details
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 25 Jan 2009 14:55:42 +0000 |
parents | 2d2f4084679f |
children | 0be17f8102ed |
rev | line source |
---|---|
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (IniFileReaderTest.cs) is a part of the IBBoard.Ini.Tests library and is copyright 2009 IBBoard. |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
6 | 3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using System; |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using System.IO; |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 using NUnit.Framework; |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 namespace IBBoard.Ini |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 [TestFixture()] |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 public class IniFileReaderTest |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 [Test()] |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 public void TestIniFileReaderReturnsEmptyObjectForEmptyIniText() |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 IniFile file = IniFileReader.ReadFile(""); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 Assert.AreEqual(0, file.Sections.Length); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 } |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 [Test()] |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 public void TestIniFileReaderContainsExpectedSectionForSingleSectionIniText() |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 IniFile file = IniFileReader.ReadFile("[ASection]"); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 Assert.AreEqual(1, file.Sections.Length); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 Assert.IsTrue(file.HasSection("ASection")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 Assert.IsNotNull(file["ASection"]); |
1 | 28 Assert.AreEqual(0, file["ASection"].Keys.Length); |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 } |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 [Test()] |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 public void TestIniFileReaderContainsExpectedSectionForSingleSectionIniTextWithContent() |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
35 IniFile file = IniFileReader.ReadFile("[ASection]\nsomething=fibble"); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
36 Assert.AreEqual(1, file.Sections.Length); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 Assert.IsTrue(file.HasSection("ASection")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
38 Assert.IsNotNull(file["ASection"]); |
1 | 39 Assert.AreEqual(1, file["ASection"].Keys.Length); |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
40 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 } |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
42 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
43 [Test()] |
1 | 44 public void TestIniFileReaderContainsExpectedSectionForSingleSectionIniTextWithMultiLineContent() |
45 { | |
46 IniFile file = IniFileReader.ReadFile("[ASection]\nsomething=fibble\nfobble_key=foo\nabcde=fghij\nfoo9=bar2"); | |
47 Assert.AreEqual(1, file.Sections.Length); | |
48 Assert.IsTrue(file.HasSection("ASection")); | |
49 IniSection section = file["ASection"]; | |
50 Assert.IsNotNull(section); | |
51 Assert.AreEqual(4, section.Keys.Length); | |
52 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); | |
53 | |
54 string[] keys = new string[]{"something", "fobble_key", "abcde", "foo9"}; | |
55 | |
56 foreach (string key in keys) | |
57 { | |
58 bool found = false; | |
59 | |
60 foreach (string sectionKey in section.Keys) | |
61 { | |
62 if (key == sectionKey) | |
63 { | |
64 found = true; | |
65 break; | |
66 } | |
67 } | |
68 | |
69 Assert.IsTrue(found, "Did not find "+key); | |
70 } | |
71 } | |
72 | |
73 [Test()] | |
2 | 74 public void TestIniFileReaderContainsExpectedSectionsForTwoSectionIniTextWithContent() |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
75 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
76 IniFile file = IniFileReader.ReadFile("[ASection]\nsomething=fibble\n[BSection]\nsomethingElse=fibble"); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
77 Assert.AreEqual(2, file.Sections.Length); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
78 Assert.IsTrue(file.HasSection("ASection")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
79 Assert.IsNotNull(file["ASection"]); |
1 | 80 Assert.AreEqual(1, file["ASection"].Keys.Length); |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
81 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
82 Assert.IsTrue(file.HasSection("BSection")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
83 Assert.IsNotNull(file["BSection"]); |
1 | 84 Assert.AreEqual(1, file["BSection"].Keys.Length); |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
85 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["BSection"]); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
86 } |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
87 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
88 [Test()] |
2 | 89 public void TestIniFileReaderContainsExpectedSectionsForTwoConsecutiveSectionSectionsInText() |
90 { | |
91 IniFile file = IniFileReader.ReadFile("[SectionA]\n[SectionB]"); | |
92 Assert.AreEqual(2, file.Sections.Length); | |
93 Assert.IsTrue(file.HasSection("SectionA")); | |
94 Assert.IsNotNull(file["SectionA"]); | |
95 Assert.AreEqual(0, file["SectionA"].Keys.Length); | |
96 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["SectionA"]); | |
97 Assert.IsTrue(file.HasSection("SectionB")); | |
98 Assert.IsNotNull(file["SectionB"]); | |
99 Assert.AreEqual(0, file["SectionB"].Keys.Length); | |
100 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["SectionB"]); | |
101 } | |
102 | |
103 [Test()] | |
104 public void TestIniFileReaderContainsExpectedSectionWhenTextPaddedAtStart() | |
105 { | |
106 IniFile file = IniFileReader.ReadFile("\nnon-blank\n[ASection]\nsomething=fibble"); | |
107 Assert.AreEqual(1, file.Sections.Length); | |
108 Assert.IsTrue(file.HasSection("ASection")); | |
109 Assert.IsNotNull(file["ASection"]); | |
110 Assert.AreEqual(1, file["ASection"].Keys.Length); | |
111 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); | |
112 } | |
113 | |
114 [Test()] | |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
115 public void TestIniFileReaderReturnsEmptyObjectForEmptyIniFile() |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
116 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
117 IniFile file = IniFileReader.ReadFile(new FileInfo("EmptyFile.ini")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
118 Assert.AreEqual(0, file.Sections.Length); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
119 } |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
120 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
121 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
122 [Test()] |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
123 public void TestIniFileReaderContainsExpectedSectionForSingleSectionIniFile() |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
124 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
125 IniFile file = IniFileReader.ReadFile(new FileInfo("SingleSectionSingleLine.ini")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
126 Assert.AreEqual(1, file.Sections.Length); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
127 Assert.IsTrue(file.HasSection("ASection")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
128 Assert.IsNotNull(file["ASection"]); |
1 | 129 Assert.AreEqual(0, file["ASection"].Keys.Length); |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
130 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
131 } |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
132 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
133 [Test()] |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
134 public void TestIniFileReaderContainsExpectedSectionForSingleSectionIniFileWithContent() |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
135 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
136 IniFile file = IniFileReader.ReadFile(new FileInfo("SingleSectionWithContent.ini")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
137 Assert.AreEqual(1, file.Sections.Length); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
138 Assert.IsTrue(file.HasSection("ASection")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
139 Assert.IsNotNull(file["ASection"]); |
1 | 140 Assert.AreEqual(1, file["ASection"].Keys.Length); |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
141 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
142 } |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
143 |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
144 [Test()] |
2 | 145 public void TestIniFileReaderContainsExpectedSectionsForTwoSectionIniFileWithContent() |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
146 { |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
147 IniFile file = IniFileReader.ReadFile(new FileInfo("DoubleSectionWithContent.ini")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
148 Assert.AreEqual(2, file.Sections.Length); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
149 Assert.IsTrue(file.HasSection("ASection")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
150 Assert.IsNotNull(file["ASection"]); |
1 | 151 Assert.AreEqual(1, file["ASection"].Keys.Length); |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
152 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
153 Assert.IsTrue(file.HasSection("BSection")); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
154 Assert.IsNotNull(file["BSection"]); |
1 | 155 Assert.AreEqual(1, file["BSection"].Keys.Length); |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
156 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["BSection"]); |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
157 } |
1 | 158 |
159 [Test()] | |
160 public void TestIniFileReaderContainsExpectedSectionForSingleSectionIniFileWithMultiLineContent() | |
161 { | |
162 IniFile file = IniFileReader.ReadFile(new FileInfo("SingleSectionWithMultiLineContent.ini")); | |
163 Assert.AreEqual(1, file.Sections.Length); | |
164 Assert.IsTrue(file.HasSection("ASection")); | |
165 IniSection section = file["ASection"]; | |
166 Assert.IsNotNull(section); | |
167 Assert.AreEqual(4, section.Keys.Length); | |
168 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); | |
169 | |
170 string[] keys = new string[]{"something", "fobble_key", "abcde", "foo9"}; | |
171 | |
172 foreach (string key in keys) | |
173 { | |
174 bool found = false; | |
175 | |
176 foreach (string sectionKey in section.Keys) | |
177 { | |
178 if (key == sectionKey) | |
179 { | |
180 found = true; | |
181 break; | |
182 } | |
183 } | |
184 | |
185 Assert.IsTrue(found, "Did not find "+key); | |
186 } | |
187 } | |
2 | 188 |
189 [Test()] | |
190 public void TestIniFileReaderContainsExpectedSectionWhenFilePaddedAtStart() | |
191 { | |
192 IniFile file = IniFileReader.ReadFile(new FileInfo("StartPadded.ini")); | |
193 Assert.AreEqual(1, file.Sections.Length); | |
194 Assert.IsTrue(file.HasSection("ASection")); | |
195 Assert.IsNotNull(file["ASection"]); | |
196 Assert.AreEqual(1, file["ASection"].Keys.Length); | |
197 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["ASection"]); | |
198 } | |
199 | |
200 [Test()] | |
201 public void TestIniFileReaderContainsExpectedSectionsForTwoConsecutiveSectionSectionsInFile() | |
202 { | |
203 IniFile file = IniFileReader.ReadFile(new FileInfo("ConsecutiveSection.ini")); | |
204 Assert.AreEqual(2, file.Sections.Length); | |
205 Assert.IsTrue(file.HasSection("SectionA")); | |
206 Assert.IsNotNull(file["SectionA"]); | |
207 Assert.AreEqual(0, file["SectionA"].Keys.Length); | |
208 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["SectionA"]); | |
209 Assert.IsTrue(file.HasSection("SectionB")); | |
210 Assert.IsNotNull(file["SectionB"]); | |
211 Assert.AreEqual(0, file["SectionB"].Keys.Length); | |
212 Assert.IsNotInstanceOfType(typeof(NonExistantIniSection), file["SectionB"]); | |
213 } | |
0
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
214 } |
ada654b0648c
Re #7 - add IBBoard.Ini test\n * Add initial tests
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
215 } |