Skip to content

Commit

Permalink
Merge pull request #873 from praeclarum/updatetests
Browse files Browse the repository at this point in the history
Update tests to NUnit 3
  • Loading branch information
praeclarum authored Sep 20, 2019
2 parents fb0706d + bc26fb4 commit 77dee63
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 25 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ jobs:
runs-on: macOS-10.14

steps:

- uses: actions/checkout@v1

- name: Restore NuGets
run: nuget restore SQLite.sln

- name: Build and Test
run: make test

- name: Make nuget
- name: Make NuGet
run: |
make nuget
mkdir PackageOut
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ SRC=src/SQLite.cs src/SQLiteAsync.cs

all: test nuget

test: tests/bin/Debug/SQLite.Tests.dll tests/ApiDiff/bin/Debug/ApiDiff.exe
mono packages/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe tests/bin/Debug/SQLite.Tests.dll
mono tests/ApiDiff/bin/Debug/ApiDiff.exe
test: tests/bin/Release/SQLite.Tests.dll tests/ApiDiff/bin/Release/ApiDiff.exe
mono packages/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe tests/bin/Release/SQLite.Tests.dll
mono tests/ApiDiff/bin/Release/ApiDiff.exe

tests/bin/Debug/SQLite.Tests.dll: tests/SQLite.Tests.csproj $(SRC)
msbuild tests/SQLite.Tests.csproj
tests/bin/Release/SQLite.Tests.dll: tests/SQLite.Tests.csproj $(SRC)
msbuild /p:Configuration=Release tests/SQLite.Tests.csproj

tests/ApiDiff/bin/Debug/ApiDiff.exe: tests/ApiDiff/ApiDiff.csproj $(SRC)
msbuild tests/ApiDiff/ApiDiff.csproj
tests/ApiDiff/bin/Release/ApiDiff.exe: tests/ApiDiff/ApiDiff.csproj $(SRC)
msbuild /p:Configuration=Release tests/ApiDiff/ApiDiff.csproj

nuget: srcnuget pclnuget basenuget sqlciphernuget

Expand Down
19 changes: 12 additions & 7 deletions tests/CreateTableImplicitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ class NoAttributes
public int IndexedId { get; set; }
}

class PkAttribute
class NoAttributesNoOptions
{
public int Id { get; set; }
public string AColumn { get; set; }
public int IndexedId { get; set; }
}

class PkAttribute
{
[PrimaryKey]
public int Id { get; set; }
Expand All @@ -45,22 +52,20 @@ private void CheckPK(TestDb db)
Assert.AreEqual(2, item.Id);
}

[Test, ExpectedException (typeof(AssertionException))]
[Test]
public void WithoutImplicitMapping ()
{
var db = new TestDb ();

db.CreateTable<NoAttributes>();
db.CreateTable<NoAttributesNoOptions>();

var mapping = db.GetMapping<NoAttributes>();
var mapping = db.GetMapping<NoAttributesNoOptions> ();

Assert.IsNull (mapping.PK);
Assert.IsNull (mapping.PK, "Should not be a key");

var column = mapping.Columns[2];
Assert.AreEqual("IndexedId", column.Name);
Assert.IsFalse(column.Indices.Any());

CheckPK(db);
}

[Test]
Expand Down
5 changes: 2 additions & 3 deletions tests/CreateTableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ class NoPropObject
{
}

[Test, ExpectedException]
[Test]
public void CreateTypeWithNoProps ()
{
var db = new TestDb ();

db.CreateTable<NoPropObject> ();
Assert.Throws<Exception> (() => db.CreateTable<NoPropObject> ());
}

[Test]
Expand Down
12 changes: 7 additions & 5 deletions tests/SQLite.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down Expand Up @@ -30,18 +31,19 @@
<ConsolePause>False</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="BooleanTest.cs" />
<Compile Include="..\src\SQLite.cs" />
<Compile Include="..\src\SQLite.cs">
<Link>SQLite.cs</Link>
</Compile>
<Compile Include="ByteArrayTest.cs" />
<Compile Include="ConcurrencyTest.cs" />
<Compile Include="EnumCacheTest.cs" />
Expand Down
2 changes: 1 addition & 1 deletion tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="NUnit" version="3.12.0" targetFramework="net45" />
<package id="NUnit.Console" version="3.10.0" targetFramework="net45" />
<package id="NUnit.ConsoleRunner" version="3.10.0" targetFramework="net45" />
<package id="NUnit.Extension.NUnitProjectLoader" version="3.6.0" targetFramework="net45" />
Expand Down

0 comments on commit 77dee63

Please sign in to comment.