Mercurial > repos > IBBoard.Tests
annotate Lang/TranslationXmlLoaderTest.cs @ 49:99e4c1949c92 default tip
* Update to v2.6 of NUnit and new syntax/API changes
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 28 Apr 2013 19:32:14 +0100 |
parents | 7502653a71a0 |
children |
rev | line source |
---|---|
16
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (TranslationXmlLoader.cs) is a part of the IBBoard.Tests project and is copyright 2010 IBBoard |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
28
31fdc90f3556
* Fix license comments at top of files
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU LGPL, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
16
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using System; |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using NUnit.Framework; |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 namespace IBBoard.Lang |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 { |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 [TestFixture()] |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 public class TranslationXmlLoaderTest |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 { |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 [Test()] |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 public void TestLoadOfSimpleXml() |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 { |
45
7502653a71a0
* Update tests - we now fix Microsoft's lack of capitalisation in language names
IBBoard <dev@ibboard.co.uk>
parents:
28
diff
changeset
|
16 TranslationXmlLoader loader = new TranslationXmlLoader(); |
24
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
17 AbstractTranslationSet translations = loader.LoadTranslations("test-data/XmlLoaderTests/translations/en.translation"); |
16
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 Assert.AreEqual("en", translations.LanguageCode); |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 Assert.AreEqual("Test String", translations["testString"]); |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 } |
24
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
21 |
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
22 [Test()] |
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
23 public void TestLoadOfInheritingXml() |
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
24 { |
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
25 ModifiableTranslationSet parentTranslations = new ModifiableTranslationSet("en"); |
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
26 Translation.AddTranslationSet(parentTranslations); |
45
7502653a71a0
* Update tests - we now fix Microsoft's lack of capitalisation in language names
IBBoard <dev@ibboard.co.uk>
parents:
28
diff
changeset
|
27 TranslationXmlLoader loader = new TranslationXmlLoader(); |
24
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
28 AbstractTranslationSet translations = loader.LoadTranslations("test-data/XmlLoaderTests/translations/en-GB.translation"); |
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
29 Assert.AreEqual("en-GB", translations.LanguageCode); |
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
30 Assert.AreEqual("British Test String", translations["testString"]); |
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
31 Assert.AreEqual(parentTranslations.Language, translations.ParentLanguage); |
948317c89fad
Re #32: Add staged loading of translations
IBBoard <dev@ibboard.co.uk>
parents:
16
diff
changeset
|
32 } |
16
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 } |
c21d27a9cae5
Re #31: Break out Translations for language to own class
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 } |