-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add .NET 9.0 compat + Drop .NET 6.0 and 7.0 support
+ Fix build
- Loading branch information
Showing
6 changed files
with
140 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<DbReaderMapperTestObject> { | ||
new DbReaderMapperTestObject(), | ||
new DbReaderMapperTestObject() { | ||
StrElement = "", | ||
public class DbReaderMapperTest { | ||
[Fact] | ||
public void Tests() { | ||
var data = new List<DbReaderMapperTestObject> { | ||
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<IDataReader>(); | ||
mock.SetupDataReader(data); | ||
IDataReader reader = mock.Object; | ||
IDataReader reader = Substitute.For<IDataReader>(); | ||
|
||
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"), | ||
}; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters