Skip to content

Commit

Permalink
update SqlClient versions and add integration test for DateOnly/TimeOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
mgravell committed Nov 22, 2021
1 parent 645d938 commit 24d7f37
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/Dapper.Tests/Dapper.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>Dapper.Tests</AssemblyName>
<Description>Dapper Core Test Suite</Description>
<TargetFrameworks>netcoreapp3.1;net462;net472;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net462;net472;net5.0;net6.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);MSSQLCLIENT</DefineConstants>
<NoWarn>$(NoWarn);IDE0017;IDE0034;IDE0037;IDE0039;IDE0042;IDE0044;IDE0051;IDE0052;IDE0059;IDE0060;IDE0063;IDE1006;xUnit1004;CA1806;CA1816;CA1822;CA1825;CA2208</NoWarn>
</PropertyGroup>
Expand All @@ -15,13 +15,13 @@
<ProjectReference Include="../../Dapper.ProviderTools/Dapper.ProviderTools.csproj" />
<ProjectReference Include="../../Dapper.SqlBuilder/Dapper.SqlBuilder.csproj" />
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="7.5.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="2.0.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="MySqlConnector" Version="1.1.0" />
<PackageReference Include="Npgsql" Version="6.0.0" />
<PackageReference Include="Snowflake.Data" Version="2.0.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

Expand Down
22 changes: 22 additions & 0 deletions tests/Dapper.Tests/ParameterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1593,5 +1593,27 @@ private static int GetExpectedListExpansionCount(int count, bool enabled)
if (delta != 0) blocks++;
return blocks * padFactor;
}

#if NET6_0_OR_GREATER
[Fact]
public void TestDateOnlyTimeOnly()
{

var now = DateTime.UtcNow;
var args = new { day = DateOnly.FromDateTime(now), time = TimeOnly.FromDateTime(now) };
//try
//{
var (day, time) = connection.QuerySingle<(DateOnly, TimeOnly)>("select @day, @time", args);

Assert.Equal(args.day, day);
Assert.Equal(args.time, time);
//}
//catch (ArgumentException ex) when (ex.StackTrace.Contains("MetaType.GetMetaTypeFromValue"))
//{
// Skip.Inconclusive("Feature not supported by provider");
//}
}

#endif
}
}
2 changes: 1 addition & 1 deletion tests/Dapper.Tests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public DbParameter CreateRawParameter(string name, object value)
public abstract class SqlServerDatabaseProvider : DatabaseProvider
{
public override string GetConnectionString() =>
GetConnectionString("SqlServerConnectionString", "Data Source=.;Initial Catalog=tempdb;Integrated Security=True");
GetConnectionString("SqlServerConnectionString", "Data Source=.;Initial Catalog=tempdb;Integrated Security=True;TrustServerCertificate=True");

public DbConnection GetOpenConnection(bool mars)
{
Expand Down

0 comments on commit 24d7f37

Please sign in to comment.