Skip to content

Commit 8622bf0

Browse files
author
Denis Voituron
committed
Fix MockDbDataReader.IsDBNull when the value is null
1 parent 9bfd35d commit 8622bf0

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

DbMocker/Data/MockDbDataReader.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public override string GetDataTypeName(int ordinal)
6363
{
6464
return _columns[ordinal].Type.Name;
6565
}
66-
66+
6767
public override DateTime GetDateTime(int ordinal)
6868
{
6969
return (DateTime)GetValue(ordinal);
@@ -166,7 +166,8 @@ public override int GetValues(object[] values)
166166

167167
public override bool IsDBNull(int ordinal)
168168
{
169-
return GetValue(ordinal) == DBNull.Value;
169+
return GetValue(ordinal) == DBNull.Value ||
170+
GetValue(ordinal) == null;
170171
}
171172

172173
public override bool NextResult()

DbMocker/DbMocker.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<AssemblyName>Apps72.Dev.Data.DbMocker</AssemblyName>
66
<RootNamespace>Apps72.Dev.Data.DbMocker</RootNamespace>
7-
<Version>1.14.0</Version>
7+
<Version>1.15.0</Version>
88
<PackageId>DbMocker</PackageId>
99
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1010
<Authors>Denis Voituron</Authors>
@@ -25,10 +25,10 @@ conn.Mocks
2525
<PackageTags>DbMocker, Mocker, SQLServer, Oracle, Sqlite, EntityFramework, EF, Dapper, UnitTest</PackageTags>
2626
<PackageReleaseNotes>https://github.com/Apps72/DbMocker</PackageReleaseNotes>
2727
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
28-
<AssemblyVersion>1.14.0.0</AssemblyVersion>
28+
<AssemblyVersion>1.15.0.0</AssemblyVersion>
2929
<PackageProjectUrl>https://github.com/Apps72/DbMocker</PackageProjectUrl>
3030
<RepositoryUrl>https://github.com/Apps72/DbMocker</RepositoryUrl>
31-
<FileVersion>1.14.0.0</FileVersion>
31+
<FileVersion>1.15.0.0</FileVersion>
3232
</PropertyGroup>
3333

3434
<ItemGroup>

ReadMe.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ var conn = new MockDbConnection()
228228

229229
## Releases
230230

231+
## Version 1.15
232+
- Fix `MockDbDataReader.IsDBNull` when the value is null.
233+
231234
## Version 1.14
232235
- Add 'Guid' type in `MockTable.FromFixed` and resource sample files.
233236
- Add a custom message when a sample conversion fails. Ex: `Invalid conversion of "2020-01-32" to "DateTime", for column "Col1"`.

0 commit comments

Comments
 (0)