未验证 提交 77dee633 编写于 作者: F Frank A. Krueger 提交者: GitHub

Merge pull request #873 from praeclarum/updatetests

Update tests to NUnit 3
...@@ -8,13 +8,16 @@ jobs: ...@@ -8,13 +8,16 @@ jobs:
runs-on: macOS-10.14 runs-on: macOS-10.14
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Restore NuGets
run: nuget restore SQLite.sln
- name: Build and Test - name: Build and Test
run: make test run: make test
- name: Make nuget - name: Make NuGet
run: | run: |
make nuget make nuget
mkdir PackageOut mkdir PackageOut
......
...@@ -3,15 +3,15 @@ SRC=src/SQLite.cs src/SQLiteAsync.cs ...@@ -3,15 +3,15 @@ SRC=src/SQLite.cs src/SQLiteAsync.cs
all: test nuget all: test nuget
test: tests/bin/Debug/SQLite.Tests.dll 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/Debug/SQLite.Tests.dll mono packages/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe tests/bin/Release/SQLite.Tests.dll
mono tests/ApiDiff/bin/Debug/ApiDiff.exe mono tests/ApiDiff/bin/Release/ApiDiff.exe
tests/bin/Debug/SQLite.Tests.dll: tests/SQLite.Tests.csproj $(SRC) tests/bin/Release/SQLite.Tests.dll: tests/SQLite.Tests.csproj $(SRC)
msbuild tests/SQLite.Tests.csproj msbuild /p:Configuration=Release tests/SQLite.Tests.csproj
tests/ApiDiff/bin/Debug/ApiDiff.exe: tests/ApiDiff/ApiDiff.csproj $(SRC) tests/ApiDiff/bin/Release/ApiDiff.exe: tests/ApiDiff/ApiDiff.csproj $(SRC)
msbuild tests/ApiDiff/ApiDiff.csproj msbuild /p:Configuration=Release tests/ApiDiff/ApiDiff.csproj
nuget: srcnuget pclnuget basenuget sqlciphernuget nuget: srcnuget pclnuget basenuget sqlciphernuget
......
...@@ -25,7 +25,14 @@ namespace SQLite.Tests ...@@ -25,7 +25,14 @@ namespace SQLite.Tests
public int IndexedId { get; set; } 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] [PrimaryKey]
public int Id { get; set; } public int Id { get; set; }
...@@ -45,22 +52,20 @@ namespace SQLite.Tests ...@@ -45,22 +52,20 @@ namespace SQLite.Tests
Assert.AreEqual(2, item.Id); Assert.AreEqual(2, item.Id);
} }
[Test, ExpectedException (typeof(AssertionException))] [Test]
public void WithoutImplicitMapping () public void WithoutImplicitMapping ()
{ {
var db = new TestDb (); 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]; var column = mapping.Columns[2];
Assert.AreEqual("IndexedId", column.Name); Assert.AreEqual("IndexedId", column.Name);
Assert.IsFalse(column.Indices.Any()); Assert.IsFalse(column.Indices.Any());
CheckPK(db);
} }
[Test] [Test]
......
...@@ -20,12 +20,11 @@ namespace SQLite.Tests ...@@ -20,12 +20,11 @@ namespace SQLite.Tests
{ {
} }
[Test, ExpectedException] [Test]
public void CreateTypeWithNoProps () public void CreateTypeWithNoProps ()
{ {
var db = new TestDb (); var db = new TestDb ();
Assert.Throws<Exception> (() => db.CreateTable<NoPropObject> ());
db.CreateTable<NoPropObject> ();
} }
[Test] [Test]
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <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> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
...@@ -30,18 +31,19 @@ ...@@ -30,18 +31,19 @@
<ConsolePause>False</ConsolePause> <ConsolePause>False</ConsolePause>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="Microsoft.VisualBasic" /> <Reference Include="Microsoft.VisualBasic" />
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
<Compile Include="BooleanTest.cs" /> <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="ByteArrayTest.cs" />
<Compile Include="ConcurrencyTest.cs" /> <Compile Include="ConcurrencyTest.cs" />
<Compile Include="EnumCacheTest.cs" /> <Compile Include="EnumCacheTest.cs" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <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.Console" version="3.10.0" targetFramework="net45" />
<package id="NUnit.ConsoleRunner" 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" /> <package id="NUnit.Extension.NUnitProjectLoader" version="3.6.0" targetFramework="net45" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册