Mercurial > repos > IBBoard.Ini.Tests
view IniLineParserTest.cs @ 13:48b646dd1dc2 default tip
* Automated clean-up of .csproj file
* Ignore generated files
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 07 Nov 2012 20:23:16 +0000 |
parents | 4f281289bcdd |
children |
line wrap: on
line source
// This file (IniLineParserTest.cs) is a part of the IBBoard.Ini.Tests library and is copyright 2009 IBBoard. // // 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. using System; using NUnit.Framework; namespace IBBoard.Ini { [TestFixture()] public class IniLineParserTest { [Test()] public void TestIniLineParserReturnsExceptedKeyValuePairForValidProperty() { IIniLine iniLine = IniLineParser.ParseIniLine("some_key=some_value"); Assert.IsInstanceOfType(typeof(IniKeyValuePairLine), iniLine); IniKeyValuePairLine keyValuePair = (IniKeyValuePairLine)iniLine; Assert.AreEqual("some_key", keyValuePair.Key); Assert.AreEqual("some_value", keyValuePair.Value); } [Test()] public void TestIniLineParserReturnsExceptedKeyValuePairForPaddedValidProperty() { IIniLine iniLine = IniLineParser.ParseIniLine(" some_key = some_value "); Assert.IsInstanceOfType(typeof(IniKeyValuePairLine), iniLine); IniKeyValuePairLine keyValuePair = (IniKeyValuePairLine)iniLine; Assert.AreEqual("some_key", keyValuePair.Key); Assert.AreEqual("some_value", keyValuePair.Value); } [Test()] public void TestIniLineParserReturnsCommentLineForNonProperty() { IIniLine iniLine = IniLineParser.ParseIniLine("something that isn't a property"); Assert.IsInstanceOfType(typeof(IniCommentLine), iniLine); IniCommentLine commentLine = (IniCommentLine)iniLine; Assert.AreEqual("something that isn't a property", commentLine.Comment); } [Test()] public void TestIniLineParserReturnsCommentForComment() { IIniLine iniLine = IniLineParser.ParseIniLine("; something that looks like a comment"); Assert.IsInstanceOfType(typeof(IniCommentLine), iniLine); IniCommentLine commentLine = (IniCommentLine)iniLine; Assert.AreEqual(" something that looks like a comment", commentLine.Comment); } } }