[banshee] Fix failing test when using Unix IO backend



commit 9cf5c85b2f4ef88b25ab50427d64f8c2ee094d06
Author: Jeroen Budts <jeroen lightyear be>
Date:   Fri Apr 9 15:59:42 2010 +0200

    Fix failing test when using Unix IO backend
    
    The Unix IO backend was failing in Banshee.IO.Tests.GetChildFiles()
    because the files were read in a different order (bgo#615336)
    
    Signed-off-by: Gabriel Burt <gabriel burt gmail com>

 src/Core/Banshee.Core/Banshee.IO/Tests.cs |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.IO/Tests.cs b/src/Core/Banshee.Core/Banshee.IO/Tests.cs
index b1c3d5f..3ecc540 100644
--- a/src/Core/Banshee.Core/Banshee.IO/Tests.cs
+++ b/src/Core/Banshee.Core/Banshee.IO/Tests.cs
@@ -336,13 +336,28 @@ namespace Banshee.IO
             ForEachProvider (() => {
                 var files = Directory.GetFiles (tmp_dir).ToArray ();
                 if (Provider.LocalOnly) {
-                    Assert.AreEqual (new string [] { baz.LocalPath, foo.LocalPath }, files);
+                    AssertContainsSameElements (new string [] { baz.LocalPath, foo.LocalPath }, files);
                 } else {
-                    Assert.AreEqual (new string [] { foo.AbsoluteUri, baz.AbsoluteUri }, files);
+                    AssertContainsSameElements (new string [] { foo.AbsoluteUri, baz.AbsoluteUri }, files);
                 }
             });
         }
 
+        private void AssertContainsSameElements (string [] expected, string [] actual)
+        {
+            if (expected.Length != actual.Length) {
+                throw new Exception (string.Format ("Expected {0} elements, but found {1} elements",
+                                                        expected.Count (), actual.Count ()));
+            }
+
+            foreach (var item in expected) {
+                if (!actual.Contains (item)) {
+                    throw new Exception (string.Format ("Expected element {0} not found in actual array",
+                                                            item));
+                }
+            }
+        }
+
         [Test]
         public void GetChildDirs ()
         {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]