From f9ede056ae0e7bc44dab91cbe50ccaef57da606c Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 28 Oct 2024 22:38:02 +0200 Subject: [PATCH 1/4] Upgrade to .NET 8 --- .github/workflows/dotnet.yml | 2 +- RqliteDotnet.Test/DtoTests.cs | 8 ++--- RqliteDotnet.Test/RqliteClientTests.cs | 40 +++++++++++----------- RqliteDotnet.Test/RqliteDotnet.Test.csproj | 8 ++--- RqliteDotnet/RqliteDotnet.csproj | 4 +-- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 31607fa..009d6c1 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -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 diff --git a/RqliteDotnet.Test/DtoTests.cs b/RqliteDotnet.Test/DtoTests.cs index 9f9f106..c93a255 100644 --- a/RqliteDotnet.Test/DtoTests.cs +++ b/RqliteDotnet.Test/DtoTests.cs @@ -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] @@ -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\"")); } } \ No newline at end of file diff --git a/RqliteDotnet.Test/RqliteClientTests.cs b/RqliteDotnet.Test/RqliteClientTests.cs index 5c56c14..fe79967 100644 --- a/RqliteDotnet.Test/RqliteClientTests.cs +++ b/RqliteDotnet.Test/RqliteClientTests.cs @@ -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.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); } [Test] @@ -30,9 +30,9 @@ public async Task QueryWithGenerics_Works() var rqClient = new RqliteOrmClient("http://localhost:6000", client); var queryresults = await rqClient.Query("select * from foo"); - Assert.AreEqual(1, queryresults.Count); - Assert.AreEqual(1, queryresults[0].Id); - Assert.AreEqual("john", queryresults[0].Name); + // Assert.AreEqual(1, queryresults.Count); + // Assert.AreEqual(1, queryresults[0].Id); + // Assert.AreEqual("john", queryresults[0].Name); } [Test] @@ -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.AreEqual(1, queryresults.Count); + // Assert.AreEqual(1, queryresults[0].Id); + // Assert.AreEqual("john", queryresults[0].Name); } [Test] @@ -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.AreEqual(1, result.Results.Count); + // Assert.AreEqual(1, result.Results[0].RowsAffected); + // Assert.AreEqual(2, result.Results[0].LastInsertId); } [Test] @@ -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.AreEqual(1, result.Results.Count); + // Assert.AreEqual(1, result.Results[0].RowsAffected); + // Assert.AreEqual(2, result.Results[0].LastInsertId); } [Test] @@ -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.AreEqual(1, result.Results.Count); + // Assert.AreEqual(2, result.Results[0].Values[0].Count); } } diff --git a/RqliteDotnet.Test/RqliteDotnet.Test.csproj b/RqliteDotnet.Test/RqliteDotnet.Test.csproj index 3b2d2f0..bcb50a8 100644 --- a/RqliteDotnet.Test/RqliteDotnet.Test.csproj +++ b/RqliteDotnet.Test/RqliteDotnet.Test.csproj @@ -1,15 +1,15 @@ - net6.0 + net8.0 false - + - - + + diff --git a/RqliteDotnet/RqliteDotnet.csproj b/RqliteDotnet/RqliteDotnet.csproj index 0e53a4f..291ce20 100644 --- a/RqliteDotnet/RqliteDotnet.csproj +++ b/RqliteDotnet/RqliteDotnet.csproj @@ -1,7 +1,7 @@ - net6.0 + net6.0;net8.0 enable enable @@ -10,7 +10,7 @@ RqliteDotnet 1.0.3 arthrp, otoolep et al. - net6.0 + net6.0;net8.0 Rqlite Dotnet .NET client for Rqlite - lightweight distributed database MIT From 6ab915cd001bf461c4234240b46ee554f086db7e Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 28 Oct 2024 22:39:23 +0200 Subject: [PATCH 2/4] Upgrade release to .NET 8 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d097fb6..c71e59f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 From a59da62e7d73e8ac1de53a3b93bcad9faae098da Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 28 Oct 2024 23:19:14 +0200 Subject: [PATCH 3/4] Fix tests --- RqliteDotnet.Test/RqliteClientTests.cs | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/RqliteDotnet.Test/RqliteClientTests.cs b/RqliteDotnet.Test/RqliteClientTests.cs index fe79967..24ec09d 100644 --- a/RqliteDotnet.Test/RqliteClientTests.cs +++ b/RqliteDotnet.Test/RqliteClientTests.cs @@ -15,11 +15,11 @@ public async Task BasicQuery_Works() var queryresult = await rqClient.Query("select * from foo"); Assert.That(queryresult!.Results!.Count, Is.EqualTo(1)); - Assert.That(queryresult.Results[0].Columns.Count, Is.EqualTo(2)); - // 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[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] @@ -30,9 +30,9 @@ public async Task QueryWithGenerics_Works() var rqClient = new RqliteOrmClient("http://localhost:6000", client); var queryresults = await rqClient.Query("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] @@ -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] @@ -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] @@ -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] @@ -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)); } } From 2df3a340e310040dbd19bfcce9311da914b0fcc4 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 28 Oct 2024 23:28:23 +0200 Subject: [PATCH 4/4] Upgrade libs --- RqliteDotnet.Test/RqliteDotnet.Test.csproj | 5 ++++- RqliteDotnet/RqliteClient.cs | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RqliteDotnet.Test/RqliteDotnet.Test.csproj b/RqliteDotnet.Test/RqliteDotnet.Test.csproj index bcb50a8..2d6c89d 100644 --- a/RqliteDotnet.Test/RqliteDotnet.Test.csproj +++ b/RqliteDotnet.Test/RqliteDotnet.Test.csproj @@ -10,7 +10,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/RqliteDotnet/RqliteClient.cs b/RqliteDotnet/RqliteClient.cs index 8783062..f99f8d2 100644 --- a/RqliteDotnet/RqliteClient.cs +++ b/RqliteDotnet/RqliteClient.cs @@ -10,8 +10,6 @@ namespace RqliteDotnet; - - public class RqliteClient : IRqliteClient { private readonly HttpClient _httpClient;