From addb2a465fd0b37cbc3f15faeb3dfb8d7369a2e3 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Thu, 19 Sep 2019 18:54:16 -0700 Subject: [PATCH 1/2] Update tests to NUnit 3 --- Makefile | 15 ++++++++------- tests/CreateTableImplicitTest.cs | 19 ++++++++++++------- tests/CreateTableTest.cs | 5 ++--- tests/SQLite.Tests.csproj | 12 +++++++----- tests/packages.config | 2 +- 5 files changed, 30 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index a8c237bb..95352dfe 100644 --- a/Makefile +++ b/Makefile @@ -3,15 +3,16 @@ 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 /t:Restore tests/SQLite.Tests.csproj + 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 diff --git a/tests/CreateTableImplicitTest.cs b/tests/CreateTableImplicitTest.cs index 416b42cf..3afb006e 100644 --- a/tests/CreateTableImplicitTest.cs +++ b/tests/CreateTableImplicitTest.cs @@ -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; } @@ -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(); + db.CreateTable(); - var mapping = db.GetMapping(); + var mapping = db.GetMapping (); - 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] diff --git a/tests/CreateTableTest.cs b/tests/CreateTableTest.cs index 74d12eb2..6acffb4b 100644 --- a/tests/CreateTableTest.cs +++ b/tests/CreateTableTest.cs @@ -20,12 +20,11 @@ class NoPropObject { } - [Test, ExpectedException] + [Test] public void CreateTypeWithNoProps () { var db = new TestDb (); - - db.CreateTable (); + Assert.Throws (() => db.CreateTable ()); } [Test] diff --git a/tests/SQLite.Tests.csproj b/tests/SQLite.Tests.csproj index 06e4de58..0c539cfd 100644 --- a/tests/SQLite.Tests.csproj +++ b/tests/SQLite.Tests.csproj @@ -1,5 +1,6 @@  + Debug AnyCPU @@ -30,18 +31,19 @@ False - - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - True - + + ..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll + - + + SQLite.cs + diff --git a/tests/packages.config b/tests/packages.config index f7f530e0..9c8b0dc6 100644 --- a/tests/packages.config +++ b/tests/packages.config @@ -1,6 +1,6 @@  - + From bc26fb49ebbb76fdbf497a680bf9c91192e87624 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Thu, 19 Sep 2019 18:59:14 -0700 Subject: [PATCH 2/2] Fix build step --- .github/workflows/build.yml | 7 +++++-- Makefile | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 510756b4..3c3eebd4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/Makefile b/Makefile index 95352dfe..7861312e 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ test: tests/bin/Release/SQLite.Tests.dll tests/ApiDiff/bin/Release/ApiDiff.exe mono tests/ApiDiff/bin/Release/ApiDiff.exe tests/bin/Release/SQLite.Tests.dll: tests/SQLite.Tests.csproj $(SRC) - msbuild /p:Configuration=Release /t:Restore tests/SQLite.Tests.csproj msbuild /p:Configuration=Release tests/SQLite.Tests.csproj tests/ApiDiff/bin/Release/ApiDiff.exe: tests/ApiDiff/ApiDiff.csproj $(SRC)