# HG changeset patch # User IBBoard # Date 1232288287 0 # Node ID 3c26f463977a4868bdb5c396986a4434e4a0b54d # Parent 2dde4c1d19d940bc658075e268fd3b358335fc77 Re #7 - Add INI parsing tests * Make IniSection throw a new DuplicateIniLineException to make testing of duplicates easier diff -r 2dde4c1d19d9 -r 3c26f463977a DuplicateIniLineException.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DuplicateIniLineException.cs Sun Jan 18 14:18:07 2009 +0000 @@ -0,0 +1,18 @@ +// This file (DuplicateIniLineException.cs) is a part of [PROJECT NAME] and is copyright 2009 IBBoard. +// +// The file and the library/program it is in are licensed under the GNU LGPL license. Please see COPYING.LGPL for more information and the full license. + +using System; + +namespace IBBoard.Ini +{ + /// + /// An exception that indicates that a second line has been added to an IniSection that contained the same key as an existing line + /// + public class DuplicateIniLineException : ArgumentException + { + public DuplicateIniLineException(string sectionName, string lineName) : base("The section [" + sectionName + "] already contained a line with the key '" + lineName + "'") + { + } + } +} diff -r 2dde4c1d19d9 -r 3c26f463977a IBBoard.Ini.mdp --- a/IBBoard.Ini.mdp Mon Jan 12 20:34:07 2009 +0000 +++ b/IBBoard.Ini.mdp Sun Jan 18 14:18:07 2009 +0000 @@ -28,6 +28,7 @@ + diff -r 2dde4c1d19d9 -r 3c26f463977a IniSection.cs --- a/IniSection.cs Mon Jan 12 20:34:07 2009 +0000 +++ b/IniSection.cs Sun Jan 18 14:18:07 2009 +0000 @@ -87,7 +87,9 @@ /// /// Adds an to the IniSection. If iniLine is also an - /// then it becomes available through this[key] + /// then it becomes available through this[key]. + ///

+ /// Throws a if the line is a and the key already exists ///

public void AddIniLine(IIniLine iniLine) { @@ -102,7 +104,7 @@ } else { - throw new ArgumentException("The key '"+key+"' was already defined in ["+Name+"]"); + throw new DuplicateIniLineException(Name, key); } }