diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 8d52b67..de8913f 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -26,7 +26,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - uses: actions/setup-java@v4 with: diff --git a/.gitignore b/.gitignore index 3e759b7..915fdcc 100644 --- a/.gitignore +++ b/.gitignore @@ -328,3 +328,5 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ + +Dysnomia.Common.SQL/Dysnomia.Common.SQL.xml diff --git a/Dysnomia.Common.SQL.Tests/DataTableHelperTest.cs b/Dysnomia.Common.SQL.Tests/DataTableHelperTest.cs index 5d92eef..4abc93c 100644 --- a/Dysnomia.Common.SQL.Tests/DataTableHelperTest.cs +++ b/Dysnomia.Common.SQL.Tests/DataTableHelperTest.cs @@ -1,37 +1,36 @@ - -using Xunit; +using Xunit; namespace Dysnomia.Common.SQL.Tests { - public class TestObject { - public string Foo { get; set; } - public int Bar { get; set; } - } + public class TestObject { + public string Foo { get; set; } + public int Bar { get; set; } + } - public class DataTableHelperTest { - [Fact] - public void CreateDataTableFromObject_null() { - var testObject = new TestObject() { - Foo = null, - Bar = 0 - }; + public class DataTableHelperTest { + [Fact] + public void CreateDataTableFromObject_null() { + var testObject = new TestObject() { + Foo = null, + Bar = 0 + }; - Assert.Equal( - 1, - DataTableHelper.CreateDataTableFromObject(testObject).Rows.Count - ); - } + Assert.Equal( + 1, + DataTableHelper.CreateDataTableFromObject(testObject).Rows.Count + ); + } - [Fact] - public void CreateDataTableFromObject_string() { - var testObject = new TestObject() { - Foo = "test", - Bar = 0 - }; + [Fact] + public void CreateDataTableFromObject_string() { + var testObject = new TestObject() { + Foo = "test", + Bar = 0 + }; - Assert.Equal( - 1, - DataTableHelper.CreateDataTableFromObject(testObject).Rows.Count - ); - } - } + Assert.Equal( + 1, + DataTableHelper.CreateDataTableFromObject(testObject).Rows.Count + ); + } + } } diff --git a/Dysnomia.Common.SQL.Tests/DbNullHelperTest.cs b/Dysnomia.Common.SQL.Tests/DbNullHelperTest.cs index 97fe018..343c656 100644 --- a/Dysnomia.Common.SQL.Tests/DbNullHelperTest.cs +++ b/Dysnomia.Common.SQL.Tests/DbNullHelperTest.cs @@ -3,33 +3,33 @@ using Xunit; namespace Dysnomia.Common.SQL.Tests { - public class DbNullHelperTest { - [Fact] - public void DbNullOrString_EmptyString() { - Assert.Equal( - "".DbNullOrString(), - DBNull.Value - ); - } + public class DbNullHelperTest { + [Fact] + public void DbNullOrString_EmptyString() { + Assert.Equal( + "".DbNullOrString(), + DBNull.Value + ); + } - [Fact] - public void DbNullOrString_Null() { - string str = null; + [Fact] + public void DbNullOrString_Null() { + string str = null; - Assert.Equal( - str.DbNullOrString(), - DBNull.Value - ); - } + Assert.Equal( + str.DbNullOrString(), + DBNull.Value + ); + } - [Fact] - public void DbNullOrString_String() { - var str = "data"; + [Fact] + public void DbNullOrString_String() { + var str = "data"; - Assert.Equal( - str.DbNullOrString(), - str - ); - } - } + Assert.Equal( + str.DbNullOrString(), + str + ); + } + } } diff --git a/Dysnomia.Common.SQL.Tests/DbReaderMapperTest.cs b/Dysnomia.Common.SQL.Tests/DbReaderMapperTest.cs index f94f41e..e7c05a5 100644 --- a/Dysnomia.Common.SQL.Tests/DbReaderMapperTest.cs +++ b/Dysnomia.Common.SQL.Tests/DbReaderMapperTest.cs @@ -1,113 +1,110 @@ -using System; +using NSubstitute; + +using System; using System.Collections.Generic; using System.Data; -using Moq; -using Moq.DataReader; - using Xunit; namespace Dysnomia.Common.SQL.Tests { - public class DbReaderMapperTestObject { - public string StrElement { get; set; } + public class DbReaderMapperTestObject { + public string StrElement { get; set; } - public uint UShortElement { get; set; } - public uint? NullableUShortElement { get; set; } - public int ShortElement { get; set; } - public int? NullableShortElement { get; set; } + public uint UShortElement { get; set; } + public uint? NullableUShortElement { get; set; } + public int ShortElement { get; set; } + public int? NullableShortElement { get; set; } - public uint UIntElement { get; set; } - public uint? NullableUIntElement { get; set; } - public int IntElement { get; set; } - public int? NullableIntElement { get; set; } + public uint UIntElement { get; set; } + public uint? NullableUIntElement { get; set; } + public int IntElement { get; set; } + public int? NullableIntElement { get; set; } - public long LongElement { get; set; } - public long? NullableLongElement { get; set; } - public ulong UlongElement { get; set; } - public ulong? NullableUlongElement { get; set; } + public long LongElement { get; set; } + public long? NullableLongElement { get; set; } + public ulong UlongElement { get; set; } + public ulong? NullableUlongElement { get; set; } - public decimal DecimalElement { get; set; } - public decimal? NullableDecimalElement { get; set; } + public decimal DecimalElement { get; set; } + public decimal? NullableDecimalElement { get; set; } - public double DoubleElement { get; set; } - public double? NullableDoubleElement { get; set; } + public double DoubleElement { get; set; } + public double? NullableDoubleElement { get; set; } - public bool BoolElement { get; set; } - public bool? NullableBoolElement { get; set; } + public bool BoolElement { get; set; } + public bool? NullableBoolElement { get; set; } - public DateTime DateTimeElement { get; set; } - public DateTime? NullableDateElement { get; set; } + public DateTime DateTimeElement { get; set; } + public DateTime? NullableDateElement { get; set; } - //public Guid GuidElement { get; set; } - //public Guid? NullableGuidElement { get; set; } - } + //public Guid GuidElement { get; set; } + //public Guid? NullableGuidElement { get; set; } + } - public class DbReaderMapperTest { - [Fact] - public void Tests() { - var data = new List { - new DbReaderMapperTestObject(), - new DbReaderMapperTestObject() { - StrElement = "", + public class DbReaderMapperTest { + [Fact] + public void Tests() { + var data = new List { + new DbReaderMapperTestObject(), + new DbReaderMapperTestObject() { + StrElement = "", - NullableUShortElement = 0, - NullableShortElement = 0, + NullableUShortElement = 0, + NullableShortElement = 0, - NullableUIntElement = 0, - NullableIntElement = 0, + NullableUIntElement = 0, + NullableIntElement = 0, - NullableLongElement = 0, - NullableUlongElement = 0, + NullableLongElement = 0, + NullableUlongElement = 0, - NullableDecimalElement = 0, + NullableDecimalElement = 0, - NullableDoubleElement = 0, + NullableDoubleElement = 0, - NullableBoolElement = false, + NullableBoolElement = false, - NullableDateElement = DateTime.Now, - } - }; + NullableDateElement = DateTime.Now, + } + }; - var mock = new Mock(); - mock.SetupDataReader(data); - IDataReader reader = mock.Object; + IDataReader reader = Substitute.For(); - while (reader.Read()) { - _ = new DbReaderMapperTestObject() { - StrElement = reader.GetString("StrElement"), + while (reader.Read()) { + _ = new DbReaderMapperTestObject() { + StrElement = reader.GetString("StrElement"), - UShortElement = reader.GetUShort("UShortElement"), - NullableUShortElement = reader.GetNullableUShort("NullableUShortElement"), - ShortElement = reader.GetShort("ShortElement"), - NullableShortElement = reader.GetNullableShort("NullableShortElement"), + UShortElement = reader.GetUShort("UShortElement"), + NullableUShortElement = reader.GetNullableUShort("NullableUShortElement"), + ShortElement = reader.GetShort("ShortElement"), + NullableShortElement = reader.GetNullableShort("NullableShortElement"), - UIntElement = reader.GetUInt("UIntElement"), - NullableUIntElement = reader.GetNullableUInt("NullableUIntElement"), - IntElement = reader.GetInt("IntElement"), - NullableIntElement = reader.GetNullableInt("NullableIntElement"), + UIntElement = reader.GetUInt("UIntElement"), + NullableUIntElement = reader.GetNullableUInt("NullableUIntElement"), + IntElement = reader.GetInt("IntElement"), + NullableIntElement = reader.GetNullableInt("NullableIntElement"), - LongElement = reader.GetLong("LongElement"), - NullableLongElement = reader.GetNullableLong("NullableLongElement"), - UlongElement = reader.GetULong("UlongElement"), - NullableUlongElement = reader.GetNullableULong("NullableUlongElement"), + LongElement = reader.GetLong("LongElement"), + NullableLongElement = reader.GetNullableLong("NullableLongElement"), + UlongElement = reader.GetULong("UlongElement"), + NullableUlongElement = reader.GetNullableULong("NullableUlongElement"), - DecimalElement = reader.GetDecimal("DecimalElement"), - NullableDecimalElement = reader.GetNullableDecimal("NullableDecimalElement"), + DecimalElement = reader.GetDecimal("DecimalElement"), + NullableDecimalElement = reader.GetNullableDecimal("NullableDecimalElement"), - DoubleElement = reader.GetDouble("DoubleElement"), - NullableDoubleElement = reader.GetNullableDouble("NullableDoubleElement"), + DoubleElement = reader.GetDouble("DoubleElement"), + NullableDoubleElement = reader.GetNullableDouble("NullableDoubleElement"), - BoolElement = reader.GetBoolean("BoolElement"), - NullableBoolElement = reader.GetNullableBoolean("NullableBoolElement"), + BoolElement = reader.GetBoolean("BoolElement"), + NullableBoolElement = reader.GetNullableBoolean("NullableBoolElement"), - DateTimeElement = reader.GetDateTime("DateTimeElement"), - NullableDateElement = reader.GetNullableDateTime("NullableDateElement"), + DateTimeElement = reader.GetDateTime("DateTimeElement"), + NullableDateElement = reader.GetNullableDateTime("NullableDateElement"), - //GuidElement = reader.GetGuid("GuidElement"), - //NullableGuidElement = reader.GetNullableGuid("NullableGuidElement"), - }; - } - } - } + //GuidElement = reader.GetGuid("GuidElement"), + //NullableGuidElement = reader.GetNullableGuid("NullableGuidElement"), + }; + } + } + } } diff --git a/Dysnomia.Common.SQL.Tests/Dysnomia.Common.SQL.Tests.csproj b/Dysnomia.Common.SQL.Tests/Dysnomia.Common.SQL.Tests.csproj index 302dcb7..95eb89b 100644 --- a/Dysnomia.Common.SQL.Tests/Dysnomia.Common.SQL.Tests.csproj +++ b/Dysnomia.Common.SQL.Tests/Dysnomia.Common.SQL.Tests.csproj @@ -1,16 +1,16 @@ - net8.0 + net9.0 false - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Dysnomia.Common.SQL/Dysnomia.Common.SQL.csproj b/Dysnomia.Common.SQL/Dysnomia.Common.SQL.csproj index e957378..e0adff5 100644 --- a/Dysnomia.Common.SQL/Dysnomia.Common.SQL.csproj +++ b/Dysnomia.Common.SQL/Dysnomia.Common.SQL.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 Axel "Elanis" Soupé Dysnomia A driver agnostic Micro-ORM for .NET Core @@ -12,7 +12,7 @@ 1.0.0 1.0.0 1.0.0 - Dysnomia.Common.SteamWebAPI.xml + true ..\Doc.md