Skip to content

Commit 77dee63

Browse files
authored
Merge pull request praeclarum#873 from praeclarum/updatetests
Update tests to NUnit 3
2 parents fb0706d + bc26fb4 commit 77dee63

File tree

6 files changed

+34
-25
lines changed

6 files changed

+34
-25
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ jobs:
88
runs-on: macOS-10.14
99

1010
steps:
11-
11+
1212
- uses: actions/checkout@v1
1313

14+
- name: Restore NuGets
15+
run: nuget restore SQLite.sln
16+
1417
- name: Build and Test
1518
run: make test
1619

17-
- name: Make nuget
20+
- name: Make NuGet
1821
run: |
1922
make nuget
2023
mkdir PackageOut

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ SRC=src/SQLite.cs src/SQLiteAsync.cs
33

44
all: test nuget
55

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

10-
tests/bin/Debug/SQLite.Tests.dll: tests/SQLite.Tests.csproj $(SRC)
11-
msbuild tests/SQLite.Tests.csproj
10+
tests/bin/Release/SQLite.Tests.dll: tests/SQLite.Tests.csproj $(SRC)
11+
msbuild /p:Configuration=Release tests/SQLite.Tests.csproj
1212

13-
tests/ApiDiff/bin/Debug/ApiDiff.exe: tests/ApiDiff/ApiDiff.csproj $(SRC)
14-
msbuild tests/ApiDiff/ApiDiff.csproj
13+
tests/ApiDiff/bin/Release/ApiDiff.exe: tests/ApiDiff/ApiDiff.csproj $(SRC)
14+
msbuild /p:Configuration=Release tests/ApiDiff/ApiDiff.csproj
1515

1616
nuget: srcnuget pclnuget basenuget sqlciphernuget
1717

tests/CreateTableImplicitTest.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ class NoAttributes
2525
public int IndexedId { get; set; }
2626
}
2727

28-
class PkAttribute
28+
class NoAttributesNoOptions
29+
{
30+
public int Id { get; set; }
31+
public string AColumn { get; set; }
32+
public int IndexedId { get; set; }
33+
}
34+
35+
class PkAttribute
2936
{
3037
[PrimaryKey]
3138
public int Id { get; set; }
@@ -45,22 +52,20 @@ private void CheckPK(TestDb db)
4552
Assert.AreEqual(2, item.Id);
4653
}
4754

48-
[Test, ExpectedException (typeof(AssertionException))]
55+
[Test]
4956
public void WithoutImplicitMapping ()
5057
{
5158
var db = new TestDb ();
5259

53-
db.CreateTable<NoAttributes>();
60+
db.CreateTable<NoAttributesNoOptions>();
5461

55-
var mapping = db.GetMapping<NoAttributes>();
62+
var mapping = db.GetMapping<NoAttributesNoOptions> ();
5663

57-
Assert.IsNull (mapping.PK);
64+
Assert.IsNull (mapping.PK, "Should not be a key");
5865

5966
var column = mapping.Columns[2];
6067
Assert.AreEqual("IndexedId", column.Name);
6168
Assert.IsFalse(column.Indices.Any());
62-
63-
CheckPK(db);
6469
}
6570

6671
[Test]

tests/CreateTableTest.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ class NoPropObject
2020
{
2121
}
2222

23-
[Test, ExpectedException]
23+
[Test]
2424
public void CreateTypeWithNoProps ()
2525
{
2626
var db = new TestDb ();
27-
28-
db.CreateTable<NoPropObject> ();
27+
Assert.Throws<Exception> (() => db.CreateTable<NoPropObject> ());
2928
}
3029

3130
[Test]

tests/SQLite.Tests.csproj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
34
<PropertyGroup>
45
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
56
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -30,18 +31,19 @@
3031
<ConsolePause>False</ConsolePause>
3132
</PropertyGroup>
3233
<ItemGroup>
33-
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
34-
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
35-
<Private>True</Private>
36-
</Reference>
3734
<Reference Include="System" />
3835
<Reference Include="System.Core" />
3936
<Reference Include="Microsoft.VisualBasic" />
37+
<Reference Include="nunit.framework">
38+
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
39+
</Reference>
4040
</ItemGroup>
4141
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
4242
<ItemGroup>
4343
<Compile Include="BooleanTest.cs" />
44-
<Compile Include="..\src\SQLite.cs" />
44+
<Compile Include="..\src\SQLite.cs">
45+
<Link>SQLite.cs</Link>
46+
</Compile>
4547
<Compile Include="ByteArrayTest.cs" />
4648
<Compile Include="ConcurrencyTest.cs" />
4749
<Compile Include="EnumCacheTest.cs" />

tests/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="NUnit" version="2.6.4" targetFramework="net45" />
3+
<package id="NUnit" version="3.12.0" targetFramework="net45" />
44
<package id="NUnit.Console" version="3.10.0" targetFramework="net45" />
55
<package id="NUnit.ConsoleRunner" version="3.10.0" targetFramework="net45" />
66
<package id="NUnit.Extension.NUnitProjectLoader" version="3.6.0" targetFramework="net45" />

0 commit comments

Comments
 (0)