Skip to content

Commit

Permalink
Upgrade to .NET 8 and NUnit 4 (#11)
Browse files Browse the repository at this point in the history
* Upgrade to .NET 8

* Upgrade release to .NET 8

* Fix tests

* Upgrade libs
  • Loading branch information
arthrp authored Oct 28, 2024
1 parent 38a71d2 commit 9432acb
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Build
run: dotnet build
- name: Pack
Expand Down
8 changes: 4 additions & 4 deletions RqliteDotnet.Test/DtoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public void QueryParameterSerialization_Works()
var qNum = new QueryParameter() { Value = 10, ParamType = QueryParamType.Number };
var qpStr = new QueryParameter() { Value = "Alexander", ParamType = QueryParamType.String };

Assert.AreEqual("10", qNum.ToParamString());
Assert.AreEqual("\"Alexander\"", qpStr.ToParamString());
Assert.That(qNum.ToParamString(), Is.EqualTo("10"));
Assert.That(qpStr.ToParamString(), Is.EqualTo("\"Alexander\""));
}

[Test]
Expand All @@ -21,7 +21,7 @@ public void NamedQueryParameterSerialization_Works()
var qNum = new NamedQueryParameter() {Name = "age", Value = 10, ParamType = QueryParamType.Number };
var qStr = new NamedQueryParameter() {Name = "name", Value = "Alexander", ParamType = QueryParamType.String };

Assert.AreEqual("\"age\":10", qNum.ToParamString());
Assert.AreEqual("\"name\":\"Alexander\"", qStr.ToParamString());
Assert.That(qNum.ToParamString(), Is.EqualTo("\"age\":10"));
Assert.That(qStr.ToParamString(), Is.EqualTo("\"name\":\"Alexander\""));
}
}
40 changes: 20 additions & 20 deletions RqliteDotnet.Test/RqliteClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public async Task BasicQuery_Works()
var rqClient = new RqliteClient("http://localhost:6000", client);
var queryresult = await rqClient.Query("select * from foo");

Assert.AreEqual(1, queryresult.Results.Count);
Assert.AreEqual(2, queryresult.Results[0].Columns.Count);
Assert.AreEqual("id", queryresult.Results[0].Columns[0]);
Assert.AreEqual("name", queryresult.Results[0].Columns[1]);
Assert.AreEqual(2, queryresult.Results[0].Types.Count);
Assert.AreEqual(1, queryresult.Results[0].Values.Count);
Assert.That(queryresult!.Results!.Count, Is.EqualTo(1));
Assert.That(queryresult!.Results[0]!.Columns!.Count, Is.EqualTo(2));
Assert.That(queryresult.Results[0].Columns[0], Is.EqualTo("id"));
Assert.That(queryresult.Results[0].Columns[1], Is.EqualTo("name"));
Assert.That(queryresult!.Results[0]!.Types!.Count, Is.EqualTo(2));
Assert.That(queryresult!.Results[0]!.Values!.Count, Is.EqualTo(1));
}

[Test]
Expand All @@ -30,9 +30,9 @@ public async Task QueryWithGenerics_Works()
var rqClient = new RqliteOrmClient("http://localhost:6000", client);
var queryresults = await rqClient.Query<FooResultDto>("select * from foo");

Assert.AreEqual(1, queryresults.Count);
Assert.AreEqual(1, queryresults[0].Id);
Assert.AreEqual("john", queryresults[0].Name);
Assert.That(queryresults.Count, Is.EqualTo(1));
Assert.That(queryresults[0].Id, Is.EqualTo(1));
Assert.That(queryresults[0].Name, Is.EqualTo("john"));
}

[Test]
Expand All @@ -49,9 +49,9 @@ public async Task ParametrizedQueryWithGenerics_Works()
Value = "john"
});

Assert.AreEqual(1, queryresults.Count);
Assert.AreEqual(1, queryresults[0].Id);
Assert.AreEqual("john", queryresults[0].Name);
Assert.That(queryresults.Count, Is.EqualTo(1));
Assert.That(queryresults[0].Id, Is.EqualTo(1));
Assert.That(queryresults[0].Name, Is.EqualTo("john"));
}

[Test]
Expand All @@ -62,9 +62,9 @@ public async Task BasicExecute_Works()
var rqClient = new RqliteClient("http://localhost:6000", client);
var result = await rqClient.Execute("create table newfoo (id integer primary key not null)");

Assert.AreEqual(1, result.Results.Count);
Assert.AreEqual(1, result.Results[0].RowsAffected);
Assert.AreEqual(2, result.Results[0].LastInsertId);
Assert.That(result!.Results!.Count, Is.EqualTo(1));
Assert.That(result.Results[0].RowsAffected, Is.EqualTo(1));
Assert.That(result.Results[0].LastInsertId, Is.EqualTo(2));
}

[Test]
Expand All @@ -81,9 +81,9 @@ public async Task ParametrizedExecute_Works()
}
)}, DbFlag.Transaction);

Assert.AreEqual(1, result.Results.Count);
Assert.AreEqual(1, result.Results[0].RowsAffected);
Assert.AreEqual(2, result.Results[0].LastInsertId);
Assert.That(result!.Results!.Count, Is.EqualTo(1));
Assert.That(result.Results[0].RowsAffected, Is.EqualTo(1));
Assert.That(result.Results[0].LastInsertId, Is.EqualTo(2));
}

[Test]
Expand All @@ -97,8 +97,8 @@ public async Task BasicQueryParam_Works()
ParamType = QueryParamType.String, Value = "john"
});

Assert.AreEqual(1, result.Results.Count);
Assert.AreEqual(2, result.Results[0].Values[0].Count);
Assert.That(result!.Results!.Count, Is.EqualTo(1));
Assert.That(result!.Results[0]!.Values[0]!.Count, Is.EqualTo(2));
}
}

Expand Down
13 changes: 8 additions & 5 deletions RqliteDotnet.Test/RqliteDotnet.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="coverlet.collector" Version="3.1.0" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions RqliteDotnet/RqliteClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

namespace RqliteDotnet;



public class RqliteClient : IRqliteClient
{
private readonly HttpClient _httpClient;
Expand Down
4 changes: 2 additions & 2 deletions RqliteDotnet/RqliteDotnet.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -10,7 +10,7 @@
<PackageId>RqliteDotnet</PackageId>
<Version>1.0.3</Version>
<Authors>arthrp, otoolep et al.</Authors>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<Title>Rqlite Dotnet</Title>
<Description>.NET client for Rqlite - lightweight distributed database</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down

0 comments on commit 9432acb

Please sign in to comment.