[sword-devel] c# unit test patch

Daniel Hughes trampster at gmail.com
Tue Sep 2 04:07:59 MST 2014


Attached is a patch which fixes one of the locale unit tests. This
test was assuming that english 'en' was the always the first locale
and this simply is not always the case. Meaning this test would pass
sometimes on some boxes but not on others.
-------------- next part --------------
Index: bindings/csharp/tests/ManagerTests.cs
===================================================================
--- bindings/csharp/tests/ManagerTests.cs	(revision 3254)
+++ bindings/csharp/tests/ManagerTests.cs	(working copy)
@@ -14,6 +14,7 @@
 using System;
 using NUnit.Framework;
 using System.IO;
+using System.Collections.Generic;
 using System.Linq;
 
 namespace Sword.Tests
@@ -84,13 +85,23 @@
 		public void AvailableLocales_Get_DoesntCrash()
 		{
 			//act
-			var availableLocales = _manager.AvailableLocales.ToArray();
+			string[] availableLocales = _manager.AvailableLocales.ToArray();
 			
 			//Assert
-			Assert.That (availableLocales[0].Contains("en"));
+			Assert.That (availableLocales.Length > 0);
 		}
 		
 		[Test]
+		public void AvailableLocales_Get_ContainsEnglish()
+		{
+			//act
+			string[] availableLocales = _manager.AvailableLocales.ToArray();
+			
+			//Assert
+			Assert.That (availableLocales.Any(locale => locale == "en"));
+		}
+		
+		[Test]
 		public void DefaultLocale_SetToEn_DoesntCrash()
 		{
 			//act


More information about the sword-devel mailing list