[banshee] [U1MS] Add initial unit tests



commit ed9df8b15f78f24237e0fa48dd1350f3e158bba1
Author: Rodney Dawes <dobey pwns gmail com>
Date:   Sat Dec 11 17:34:11 2010 +0100

    [U1MS] Add initial unit tests
    
    Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>

 .../Banshee.UbuntuOneMusicStore.csproj             |    1 +
 .../Tests/MusicStoreTests.cs                       |   71 ++++++++++++++++++++
 .../Banshee.UbuntuOneMusicStore/Makefile.am        |    4 +-
 tests/Makefile.am                                  |    4 +
 4 files changed, 79 insertions(+), 1 deletions(-)
---
diff --git a/src/Extensions/Banshee.UbuntuOneMusicStore/Banshee.UbuntuOneMusicStore.csproj b/src/Extensions/Banshee.UbuntuOneMusicStore/Banshee.UbuntuOneMusicStore.csproj
index f6d92b9..2ed5ab4 100644
--- a/src/Extensions/Banshee.UbuntuOneMusicStore/Banshee.UbuntuOneMusicStore.csproj
+++ b/src/Extensions/Banshee.UbuntuOneMusicStore/Banshee.UbuntuOneMusicStore.csproj
@@ -56,6 +56,7 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Banshee.UbuntuOneMusicStore\UbuntuOneMusicStoreSource.cs" />
+    <Compile Include="Banshee.UbuntuOneMusicStore\Tests\MusicStoreTests.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>
diff --git a/src/Extensions/Banshee.UbuntuOneMusicStore/Banshee.UbuntuOneMusicStore/Tests/MusicStoreTests.cs b/src/Extensions/Banshee.UbuntuOneMusicStore/Banshee.UbuntuOneMusicStore/Tests/MusicStoreTests.cs
new file mode 100644
index 0000000..ff2da45
--- /dev/null
+++ b/src/Extensions/Banshee.UbuntuOneMusicStore/Banshee.UbuntuOneMusicStore/Tests/MusicStoreTests.cs
@@ -0,0 +1,71 @@
+//
+// MusicStoreTests.cs
+//
+// Author:
+//   Rodney Dawes <rodney dawes canonical com>
+//
+// Copyright (C) 2010 Canonical, Ltd.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if ENABLE_TESTS
+
+using Gtk;
+using Mono.Addins;
+using NUnit.Framework;
+
+namespace Banshee.UbuntuOneMusicStore
+{
+    [TestFixture]
+    public class MusicStoreTests
+    {
+        [TestFixtureSetUp]
+        public void SetUp ()
+        {
+            Application.Init ();
+            AddinManager.Initialize ();
+            AddinManager.Registry.Update (null);
+        }
+
+        [TestFixtureTearDown]
+        public void TearDown ()
+        {
+            AddinManager.Shutdown ();
+        }
+
+        [Test]
+        public void TestSource ()
+        {
+            var source = new UbuntuOneMusicStoreSource ();
+            Assert.AreEqual (source.Count, 0);
+        }
+
+        [Test]
+        public void TestU1MSUrlLoaded ()
+        {
+            var store = new UbuntuOneMusicStoreSource.StoreWrapper ();
+            Assert.IsNotNull (store);
+        }
+
+    }
+}
+
+#endif
diff --git a/src/Extensions/Banshee.UbuntuOneMusicStore/Makefile.am b/src/Extensions/Banshee.UbuntuOneMusicStore/Makefile.am
index ebc1fb4..2873b5b 100644
--- a/src/Extensions/Banshee.UbuntuOneMusicStore/Makefile.am
+++ b/src/Extensions/Banshee.UbuntuOneMusicStore/Makefile.am
@@ -3,7 +3,9 @@ TARGET = library
 LINK = $(REF_EXTENSION_UBUNTUONEMUSICSTORE)
 INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)
 
-SOURCES = Banshee.UbuntuOneMusicStore/UbuntuOneMusicStoreSource.cs
+SOURCES =  \
+	Banshee.UbuntuOneMusicStore/Tests/MusicStoreTests.cs \
+	Banshee.UbuntuOneMusicStore/UbuntuOneMusicStoreSource.cs
 
 RESOURCES = Banshee.UbuntuOneMusicStore.addin.xml
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d6bed8e..74e6ec0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,6 +22,10 @@ if ENABLE_GIO
 TEST_ASSEMBLIES += Banshee.Gio.dll
 endif
 
+if ENABLE_UBUNTUONE
+TEST_ASSEMBLIES += Banshee.UbuntuOneMusicStore.dll
+endif
+
 ENV_OPTIONS = TZ=America/Chicago LC_ALL=it_IT LANG=it_IT
 NUNIT_CONSOLE = $$(echo $$(which nunit-console2 || which nunit-console))
 RUNNER = for asm in $${TEST_ASSEMBLIES}; do echo -e "\033[1mRunning tests on $${asm}...\033[0m"; $(ENV_OPTIONS) $(NUNIT_CONSOLE) -nologo -noshadow $$asm; done



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