view IniLineParserTest.cs @ 12:0be17f8102ed

* Fix unit test paths
author IBBoard <dev@ibboard.co.uk>
date Wed, 07 Nov 2012 20:22:20 +0000
parents c2a0d074b3b5
children
line source
1 // This file (IniLineParserTest.cs) is a part of the IBBoard.Ini.Tests library and is copyright 2009 IBBoard.
2 //
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.
5 using System;
6 using NUnit.Framework;
8 namespace IBBoard.Ini
9 {
10 [TestFixture()]
11 public class IniLineParserTest
12 {
13 [Test()]
14 public void TestIniLineParserReturnsExceptedKeyValuePairForValidProperty()
15 {
16 IIniLine iniLine = IniLineParser.ParseIniLine("some_key=some_value");
17 Assert.IsInstanceOfType(typeof(IniKeyValuePairLine), iniLine);
18 IniKeyValuePairLine keyValuePair = (IniKeyValuePairLine)iniLine;
19 Assert.AreEqual("some_key", keyValuePair.Key);
20 Assert.AreEqual("some_value", keyValuePair.Value);
21 }
24 [Test()]
25 public void TestIniLineParserReturnsExceptedKeyValuePairForPaddedValidProperty()
26 {
27 IIniLine iniLine = IniLineParser.ParseIniLine(" some_key = some_value ");
28 Assert.IsInstanceOfType(typeof(IniKeyValuePairLine), iniLine);
29 IniKeyValuePairLine keyValuePair = (IniKeyValuePairLine)iniLine;
30 Assert.AreEqual("some_key", keyValuePair.Key);
31 Assert.AreEqual("some_value", keyValuePair.Value);
32 }
34 [Test()]
35 public void TestIniLineParserReturnsCommentLineForNonProperty()
36 {
37 IIniLine iniLine = IniLineParser.ParseIniLine("something that isn't a property");
38 Assert.IsInstanceOfType(typeof(IniCommentLine), iniLine);
39 IniCommentLine commentLine = (IniCommentLine)iniLine;
40 Assert.AreEqual("something that isn't a property", commentLine.Comment);
41 }
43 [Test()]
44 public void TestIniLineParserReturnsCommentForComment()
45 {
46 IIniLine iniLine = IniLineParser.ParseIniLine("; something that looks like a comment");
47 Assert.IsInstanceOfType(typeof(IniCommentLine), iniLine);
48 IniCommentLine commentLine = (IniCommentLine)iniLine;
49 Assert.AreEqual(" something that looks like a comment", commentLine.Comment);
50 }
51 }
52 }