diff options
author | Rodney Dawes <dobey.pwns@gmail.com> | 2010-12-11 17:34:11 +0100 |
---|---|---|
committer | Bertrand Lorentz <bertrand.lorentz@gmail.com> | 2010-12-11 17:39:04 +0100 |
commit | ed9df8b15f78f24237e0fa48dd1350f3e158bba1 (patch) | |
tree | bc40d51a74c042a36955849b00b2ff4f71785778 | |
parent | 0df6b19afbeab2b913bf0918204ad30c98163e36 (diff) |
[U1MS] Add initial unit tests
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
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 f6d92b955..2ed5ab4c4 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 000000000..ff2da45d2 --- /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 ebc1fb48f..2873b5b3e 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 d6bed8ecc..74e6ec0be 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 |