Fix build, upgrade SQLite integration tests to NUnit

This commit is contained in:
Rikki Tooley 2015-04-05 23:30:50 +01:00
parent f299b1f8e9
commit e30bc37f41
9 changed files with 14 additions and 34 deletions

View File

@ -45,6 +45,7 @@
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath> <HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference> </Reference>

View File

@ -10,7 +10,6 @@
namespace IF.Lastfm.Core.Tests.Api.Commands namespace IF.Lastfm.Core.Tests.Api.Commands
{ {
public class ArtistGetInfoCommandTests : CommandTestsBase public class ArtistGetInfoCommandTests : CommandTestsBase
{ {
private GetInfoCommand _command; private GetInfoCommand _command;

View File

@ -1,12 +1,9 @@
using IF.Lastfm.Core.Scrobblers; using IF.Lastfm.Core.Scrobblers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Net.Http; using System.Net.Http;
using IF.Lastfm.Core.Helpers;
using Scrobbler = IF.Lastfm.Core.Scrobblers.Scrobbler; using Scrobbler = IF.Lastfm.Core.Scrobblers.Scrobbler;
namespace IF.Lastfm.Core.Tests.Scrobblers namespace IF.Lastfm.Core.Tests.Scrobblers
{ {
[TestClass]
public class ScrobblerTests : ScrobblerTestsBase public class ScrobblerTests : ScrobblerTestsBase
{ {
protected override IScrobbler GetScrobbler() protected override IScrobbler GetScrobbler()

View File

@ -7,12 +7,11 @@
using IF.Lastfm.Core.Helpers; using IF.Lastfm.Core.Helpers;
using IF.Lastfm.Core.Scrobblers; using IF.Lastfm.Core.Scrobblers;
using IF.Lastfm.Core.Tests.Resources; using IF.Lastfm.Core.Tests.Resources;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq; using Moq;
using NUnit.Framework;
namespace IF.Lastfm.Core.Tests.Scrobblers namespace IF.Lastfm.Core.Tests.Scrobblers
{ {
[TestClass]
public abstract class ScrobblerTestsBase public abstract class ScrobblerTestsBase
{ {
protected IScrobbler Scrobbler { get; private set; } protected IScrobbler Scrobbler { get; private set; }
@ -21,7 +20,7 @@ public abstract class ScrobblerTestsBase
protected QueueFakeResponseHandler FakeResponseHandler { get; private set; } protected QueueFakeResponseHandler FakeResponseHandler { get; private set; }
[TestInitialize] [SetUp]
public void Initialise() public void Initialise()
{ {
MockAuth = new Mock<ILastAuth>(); MockAuth = new Mock<ILastAuth>();
@ -45,7 +44,7 @@ protected async Task<ScrobbleResponse> ExecuteTestInternal(HttpResponseMessage r
protected abstract IScrobbler GetScrobbler(); protected abstract IScrobbler GetScrobbler();
[TestMethod] [Test]
public async Task CorrectResponseWithBadAuth() public async Task CorrectResponseWithBadAuth()
{ {
MockAuth.SetupGet(m => m.Authenticated).Returns(false); MockAuth.SetupGet(m => m.Authenticated).Returns(false);
@ -56,7 +55,7 @@ public async Task CorrectResponseWithBadAuth()
Assert.AreEqual(LastResponseStatus.BadAuth, scrobbleResponse.Status); Assert.AreEqual(LastResponseStatus.BadAuth, scrobbleResponse.Status);
} }
[TestMethod] [Test]
public async Task CorrectResponseWhenRequestSuccessful() public async Task CorrectResponseWhenRequestSuccessful()
{ {
MockAuth.SetupGet(m => m.Authenticated).Returns(true); MockAuth.SetupGet(m => m.Authenticated).Returns(true);
@ -67,7 +66,7 @@ public async Task CorrectResponseWhenRequestSuccessful()
Assert.AreEqual(LastResponseStatus.Successful, scrobbleResponse.Status); Assert.AreEqual(LastResponseStatus.Successful, scrobbleResponse.Status);
} }
[TestMethod] [Test]
public async Task CorrectResponseWhenRequestFailed() public async Task CorrectResponseWhenRequestFailed()
{ {
MockAuth.SetupGet(m => m.Authenticated).Returns(true); MockAuth.SetupGet(m => m.Authenticated).Returns(true);

View File

@ -4,7 +4,6 @@
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using IF.Lastfm.Core.Api.Helpers; using IF.Lastfm.Core.Api.Helpers;
using NUnit.Framework; using NUnit.Framework;

View File

@ -1,12 +1,11 @@
using System; using System;
using Microsoft.VisualStudio.TestTools.UnitTesting; using NUnit.Framework;
namespace IF.Lastfm.Core.Tests namespace IF.Lastfm.Core.Tests
{ {
[TestClass]
public class TestHelperTests public class TestHelperTests
{ {
[TestMethod] [Test]
public void RoundsToNearestSecond() public void RoundsToNearestSecond()
{ {
var now = new DateTimeOffset(2015, 03, 04, 20, 07, 21, TimeSpan.Zero); var now = new DateTimeOffset(2015, 03, 04, 20, 07, 21, TimeSpan.Zero);

View File

@ -44,6 +44,9 @@
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="nunit.framework">
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="SQLite-net"> <Reference Include="SQLite-net">
<HintPath>..\..\packages\sqlite-net-pcl.1.0.11\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll</HintPath> <HintPath>..\..\packages\sqlite-net-pcl.1.0.11\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLite-net.dll</HintPath>
</Reference> </Reference>
@ -68,11 +71,7 @@
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup> </ItemGroup>
</When> </When>
<Otherwise> <Otherwise />
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose> </Choose>
<ItemGroup> <ItemGroup>
<Compile Include="SQLiteScrobblerTests.cs" /> <Compile Include="SQLiteScrobblerTests.cs" />

View File

@ -1,22 +1,8 @@
using System; using IF.Lastfm.Core.Scrobblers;
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.Tests.Scrobblers; using IF.Lastfm.Core.Tests.Scrobblers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using SQLite;
namespace IF.Lastfm.SQLite.Tests.Integration namespace IF.Lastfm.SQLite.Tests.Integration
{ {
[TestClass]
public class SQLiteeScrobblerTests : ScrobblerTestsBase public class SQLiteeScrobblerTests : ScrobblerTestsBase
{ {
protected override IScrobbler GetScrobbler() protected override IScrobbler GetScrobbler()

View File

@ -5,6 +5,7 @@
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" /> <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
<package id="Moq" version="4.2.1502.0911" targetFramework="net45" /> <package id="Moq" version="4.2.1502.0911" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" /> <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="sqlite-net-pcl" version="1.0.11" targetFramework="net45" /> <package id="sqlite-net-pcl" version="1.0.11" targetFramework="net45" />
<package id="SQLitePCL.raw_basic" version="0.7.1" targetFramework="net45" /> <package id="SQLitePCL.raw_basic" version="0.7.1" targetFramework="net45" />
</packages> </packages>