From e30bc37f41551e97e451581a744b951624c20bb6 Mon Sep 17 00:00:00 2001 From: Rikki Tooley Date: Sun, 5 Apr 2015 23:30:50 +0100 Subject: [PATCH] Fix build, upgrade SQLite integration tests to NUnit --- .../IF.Lastfm.Core.Tests.Integration.csproj | 1 + .../Api/Commands/ArtistGetInfoCommandTests.cs | 1 - .../Scrobblers/ScrobblerTests.cs | 3 --- .../Scrobblers/ScrobblerTestsBase.cs | 11 +++++------ src/IF.Lastfm.Core.Tests/TestHelper.cs | 1 - src/IF.Lastfm.Core.Tests/TestHelperTests.cs | 5 ++--- .../IF.Lastfm.SQLite.Tests.Integration.csproj | 9 ++++----- .../SQLiteScrobblerTests.cs | 16 +--------------- .../packages.config | 1 + 9 files changed, 14 insertions(+), 34 deletions(-) diff --git a/src/IF.Lastfm.Core.Tests.Integration/IF.Lastfm.Core.Tests.Integration.csproj b/src/IF.Lastfm.Core.Tests.Integration/IF.Lastfm.Core.Tests.Integration.csproj index d521f52..0466fb9 100644 --- a/src/IF.Lastfm.Core.Tests.Integration/IF.Lastfm.Core.Tests.Integration.csproj +++ b/src/IF.Lastfm.Core.Tests.Integration/IF.Lastfm.Core.Tests.Integration.csproj @@ -45,6 +45,7 @@ False ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll diff --git a/src/IF.Lastfm.Core.Tests/Api/Commands/ArtistGetInfoCommandTests.cs b/src/IF.Lastfm.Core.Tests/Api/Commands/ArtistGetInfoCommandTests.cs index 2c2cc0c..090a4af 100644 --- a/src/IF.Lastfm.Core.Tests/Api/Commands/ArtistGetInfoCommandTests.cs +++ b/src/IF.Lastfm.Core.Tests/Api/Commands/ArtistGetInfoCommandTests.cs @@ -10,7 +10,6 @@ namespace IF.Lastfm.Core.Tests.Api.Commands { - public class ArtistGetInfoCommandTests : CommandTestsBase { private GetInfoCommand _command; diff --git a/src/IF.Lastfm.Core.Tests/Scrobblers/ScrobblerTests.cs b/src/IF.Lastfm.Core.Tests/Scrobblers/ScrobblerTests.cs index f52790e..8fd310d 100644 --- a/src/IF.Lastfm.Core.Tests/Scrobblers/ScrobblerTests.cs +++ b/src/IF.Lastfm.Core.Tests/Scrobblers/ScrobblerTests.cs @@ -1,12 +1,9 @@ using IF.Lastfm.Core.Scrobblers; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Net.Http; -using IF.Lastfm.Core.Helpers; using Scrobbler = IF.Lastfm.Core.Scrobblers.Scrobbler; namespace IF.Lastfm.Core.Tests.Scrobblers { - [TestClass] public class ScrobblerTests : ScrobblerTestsBase { protected override IScrobbler GetScrobbler() diff --git a/src/IF.Lastfm.Core.Tests/Scrobblers/ScrobblerTestsBase.cs b/src/IF.Lastfm.Core.Tests/Scrobblers/ScrobblerTestsBase.cs index 6a1de99..a83f8f6 100644 --- a/src/IF.Lastfm.Core.Tests/Scrobblers/ScrobblerTestsBase.cs +++ b/src/IF.Lastfm.Core.Tests/Scrobblers/ScrobblerTestsBase.cs @@ -7,12 +7,11 @@ using IF.Lastfm.Core.Helpers; using IF.Lastfm.Core.Scrobblers; using IF.Lastfm.Core.Tests.Resources; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using NUnit.Framework; namespace IF.Lastfm.Core.Tests.Scrobblers { - [TestClass] public abstract class ScrobblerTestsBase { protected IScrobbler Scrobbler { get; private set; } @@ -21,7 +20,7 @@ public abstract class ScrobblerTestsBase protected QueueFakeResponseHandler FakeResponseHandler { get; private set; } - [TestInitialize] + [SetUp] public void Initialise() { MockAuth = new Mock(); @@ -45,7 +44,7 @@ protected async Task ExecuteTestInternal(HttpResponseMessage r protected abstract IScrobbler GetScrobbler(); - [TestMethod] + [Test] public async Task CorrectResponseWithBadAuth() { MockAuth.SetupGet(m => m.Authenticated).Returns(false); @@ -56,7 +55,7 @@ public async Task CorrectResponseWithBadAuth() Assert.AreEqual(LastResponseStatus.BadAuth, scrobbleResponse.Status); } - [TestMethod] + [Test] public async Task CorrectResponseWhenRequestSuccessful() { MockAuth.SetupGet(m => m.Authenticated).Returns(true); @@ -67,7 +66,7 @@ public async Task CorrectResponseWhenRequestSuccessful() Assert.AreEqual(LastResponseStatus.Successful, scrobbleResponse.Status); } - [TestMethod] + [Test] public async Task CorrectResponseWhenRequestFailed() { MockAuth.SetupGet(m => m.Authenticated).Returns(true); diff --git a/src/IF.Lastfm.Core.Tests/TestHelper.cs b/src/IF.Lastfm.Core.Tests/TestHelper.cs index 324be2e..a111fd5 100644 --- a/src/IF.Lastfm.Core.Tests/TestHelper.cs +++ b/src/IF.Lastfm.Core.Tests/TestHelper.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Net; using System.Net.Http; -using System.Runtime.CompilerServices; using System.Text; using IF.Lastfm.Core.Api.Helpers; using NUnit.Framework; diff --git a/src/IF.Lastfm.Core.Tests/TestHelperTests.cs b/src/IF.Lastfm.Core.Tests/TestHelperTests.cs index ff7f11e..910e215 100644 --- a/src/IF.Lastfm.Core.Tests/TestHelperTests.cs +++ b/src/IF.Lastfm.Core.Tests/TestHelperTests.cs @@ -1,12 +1,11 @@ using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; namespace IF.Lastfm.Core.Tests { - [TestClass] public class TestHelperTests { - [TestMethod] + [Test] public void RoundsToNearestSecond() { var now = new DateTimeOffset(2015, 03, 04, 20, 07, 21, TimeSpan.Zero); diff --git a/src/IF.Lastfm.SQLite.Tests.Integration/IF.Lastfm.SQLite.Tests.Integration.csproj b/src/IF.Lastfm.SQLite.Tests.Integration/IF.Lastfm.SQLite.Tests.Integration.csproj index a4c8628..020f35e 100644 --- a/src/IF.Lastfm.SQLite.Tests.Integration/IF.Lastfm.SQLite.Tests.Integration.csproj +++ b/src/IF.Lastfm.SQLite.Tests.Integration/IF.Lastfm.SQLite.Tests.Integration.csproj @@ -44,6 +44,9 @@ ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + ..\..\packages\sqlite-net-pcl.1.0.11\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll @@ -68,11 +71,7 @@ - - - - - + diff --git a/src/IF.Lastfm.SQLite.Tests.Integration/SQLiteScrobblerTests.cs b/src/IF.Lastfm.SQLite.Tests.Integration/SQLiteScrobblerTests.cs index 0edbf40..4336639 100644 --- a/src/IF.Lastfm.SQLite.Tests.Integration/SQLiteScrobblerTests.cs +++ b/src/IF.Lastfm.SQLite.Tests.Integration/SQLiteScrobblerTests.cs @@ -1,22 +1,8 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using IF.Lastfm.Core.Api; -using IF.Lastfm.Core.Api.Enums; -using IF.Lastfm.Core.Api.Helpers; -using IF.Lastfm.Core.Helpers; -using IF.Lastfm.Core.Scrobblers; -using IF.Lastfm.Core.Tests; -using IF.Lastfm.Core.Tests.Resources; +using IF.Lastfm.Core.Scrobblers; using IF.Lastfm.Core.Tests.Scrobblers; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using SQLite; namespace IF.Lastfm.SQLite.Tests.Integration { - [TestClass] public class SQLiteeScrobblerTests : ScrobblerTestsBase { protected override IScrobbler GetScrobbler() diff --git a/src/IF.Lastfm.SQLite.Tests.Integration/packages.config b/src/IF.Lastfm.SQLite.Tests.Integration/packages.config index 1669a61..e1c5439 100644 --- a/src/IF.Lastfm.SQLite.Tests.Integration/packages.config +++ b/src/IF.Lastfm.SQLite.Tests.Integration/packages.config @@ -5,6 +5,7 @@ + \ No newline at end of file