Mercurial > repos > IBBoard.Tests
changeset 16:c21d27a9cae5
Re #31: Break out Translations for language to own class
* Add initial tests for loader of new translation class
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 06 Apr 2010 16:01:29 +0000 |
parents | e3e4f7a92f8b |
children | 8288a28ba3bc |
files | IBBoard.Tests.csproj Lang/ModifiableTranslationSetTest.cs Lang/TranslationXmlLoaderTest.cs |
diffstat | 3 files changed, 24 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/IBBoard.Tests.csproj Tue Apr 06 15:43:08 2010 +0000 +++ b/IBBoard.Tests.csproj Tue Apr 06 16:01:29 2010 +0000 @@ -40,6 +40,7 @@ <Compile Include="Lang\Mock\MockTranslatable.cs" /> <Compile Include="Lang\AbstractTranslationSetTest.cs" /> <Compile Include="Lang\ModifiableTranslationSetTest.cs" /> + <Compile Include="Lang\TranslationXmlLoaderTest.cs" /> </ItemGroup> <ItemGroup> <Reference Include="System" />
--- a/Lang/ModifiableTranslationSetTest.cs Tue Apr 06 15:43:08 2010 +0000 +++ b/Lang/ModifiableTranslationSetTest.cs Tue Apr 06 16:01:29 2010 +0000 @@ -30,7 +30,7 @@ protected override AbstractTranslationSet GetTranslationSetWithFixedValue() { ModifiableTranslationSet translations = new ModifiableTranslationSet("en"); - translations[GetFixedValueKey()] = GetFixedValueTranslation(); + translations.SetTranslation(GetFixedValueKey(), GetFixedValueTranslation()); return translations; } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lang/TranslationXmlLoaderTest.cs Tue Apr 06 16:01:29 2010 +0000 @@ -0,0 +1,22 @@ +// This file (TranslationXmlLoader.cs) is a part of the IBBoard.Tests project and is copyright 2010 IBBoard +// +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. + +using System; +using NUnit.Framework; + +namespace IBBoard.Lang +{ + [TestFixture()] + public class TranslationXmlLoaderTest + { + [Test()] + public void TestLoadOfSimpleXml() + { + TranslationXmlLoader loader = new TranslationXmlLoader("test-data/schemas/translation.xsd"); + AbstractTranslationSet translations = loader.LoadTranslations("test-data/translations/en.translation"); + Assert.AreEqual("en", translations.LanguageCode); + Assert.AreEqual("Test String", translations["testString"]); + } + } +}