changeset 18:20189f3a3479

Re #34: Get name for translation * Add tests for translation names
author IBBoard <dev@ibboard.co.uk>
date Tue, 06 Apr 2010 18:19:48 +0000
parents 8288a28ba3bc
children bcb6e83752a6
files Lang/AbstractTranslationSetTest.cs Lang/ModifiableTranslationSetTest.cs
diffstat 2 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Lang/AbstractTranslationSetTest.cs	Tue Apr 06 18:08:13 2010 +0000
+++ b/Lang/AbstractTranslationSetTest.cs	Tue Apr 06 18:19:48 2010 +0000
@@ -24,7 +24,23 @@
 			Assert.AreEqual(GetFixedValueTranslation(), translations[GetFixedValueKey()]);
 		}
 		
-		protected abstract AbstractTranslationSet GetTranslationSet();
+		[Test()]
+		public void TestTranslationSetName()
+		{
+			AbstractTranslationSet translations = GetTranslationSet("en");
+			Assert.AreEqual("English", translations.LanguageName);
+			translations = GetTranslationSet("it");
+			Assert.AreEqual("italiano", translations.LanguageName);
+			translations = GetTranslationSet("zz");
+			Assert.AreEqual("Unknown (zz)", translations.LanguageName);
+		}
+
+		protected virtual AbstractTranslationSet GetTranslationSet()
+		{
+			return GetTranslationSet("en");
+		}
+		
+		protected abstract AbstractTranslationSet GetTranslationSet(string language);		
 		protected abstract AbstractTranslationSet GetTranslationSetWithFixedValue();
 		protected abstract string GetFixedValueKey();
 		protected abstract string GetFixedValueTranslation();
--- a/Lang/ModifiableTranslationSetTest.cs	Tue Apr 06 18:08:13 2010 +0000
+++ b/Lang/ModifiableTranslationSetTest.cs	Tue Apr 06 18:19:48 2010 +0000
@@ -22,9 +22,9 @@
 			return "new string";
 		}
 		
-		protected override AbstractTranslationSet GetTranslationSet()
+		protected override AbstractTranslationSet GetTranslationSet(string language)
 		{
-			return new ModifiableTranslationSet("en");
+			return new ModifiableTranslationSet(language);
 		}
 		
 		protected override AbstractTranslationSet GetTranslationSetWithFixedValue()