Skip to content

Commit

Permalink
Fixing to tests and ignoring the readonly properties #289
Browse files Browse the repository at this point in the history
  • Loading branch information
valfrid-ly committed Feb 18, 2022
1 parent 8eb2c1d commit 788878a
Show file tree
Hide file tree
Showing 36 changed files with 267 additions and 95 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/TestAndPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
os: [ubuntu-latest]
# os: [macos-latest, ubuntu-latest]
# os: [macos-latest, windows-latest, ubuntu-latest]
# dotnet: [{ framework: netcoreapp2.1, version: 2.1.x, settings: coverlet }, { framework: netcoreapp3.1, version: 3.1.x, settings: coverlet }, { framework: net5.0, version: 5.0.x, settings: coverlet }, { framework: net461, version: 4.6.1, settings: mscoverage }]
# dotnet: [{ framework: netcoreapp2.1, version: 2.1.x, settings: coverlet }, { framework: netcoreapp3.1, version: 3.1.x, settings: coverlet }, { framework: net5.0, version: 5.0.x, settings: coverlet }, { framework: net6.0, version: 6.0.x, settings: coverlet }, { framework: net461, version: 4.6.1, settings: mscoverage }]
dotnet: [{ framework: net461, version: 4.6.1, settings: mscoverage }]

steps:
Expand Down Expand Up @@ -77,6 +77,8 @@ jobs:
run: |
cd DapperExtensions.Test
sed -i 's/"IBM.Data.DB2.Core"/"IBM.Data.DB2.Core-lnx"/gI' DapperExtensions.Test.csproj
sed -i 's/"Net.IBM.Data.DB2"/"Net.IBM.Data.DB2-lnx"/gI' DapperExtensions.Test.csproj
sed -i 's/"Net5.IBM.Data.DB2"/"Net5.IBM.Data.DB2-lnx"/gI' DapperExtensions.Test.csproj
cd ..
# - name: Clean solution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net461;net5.0;netstandard2.0;netstandard2.1;</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net461;net5.0;net6.0;netstandard2.0;netstandard2.1;</TargetFrameworks>
<Version>1.7.0</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<LangVersion>8.0</LangVersion>
Expand All @@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Newtonsoft.Json" version="13.0.1" />
<PackageReference Include="Slapper.AutoMapper" Version="2.0.1" />
<PackageReference Include="Dapper" Version="2.0.90" />
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
</ItemGroup>

Expand All @@ -37,6 +37,7 @@
<file src="bin\Release\netcoreapp2.1\$(AssemblyName).dll" target="lib\netcoreapp2.1\$(AssemblyName).dll" />
<file src="bin\Release\netcoreapp3.1\$(AssemblyName).dll" target="lib\netcoreapp3.1\$(AssemblyName).dll" />
<file src="bin\Release\net5.0\$(AssemblyName).dll" target="lib\net5.0\$(AssemblyName).dll" />
<file src="bin\Release\net6.0\$(AssemblyName).dll" target="lib\net6.0\$(AssemblyName).dll" />
<file src="bin\Release\netstandard2.0\$(AssemblyName).dll" target="lib\netstandard2.0\$(AssemblyName).dll" />
<file src="bin\Release\netstandard2.1\$(AssemblyName).dll" target="lib\netstandard2.1\$(AssemblyName).dll" />
</files>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net461;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net461;net5.0;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -10,12 +10,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="MySql.Data" Version="8.0.24" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="MySql.Data" Version="8.0.28" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="ReportGenerator" Version="4.8.8" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.15.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="ReportGenerator" Version="5.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions DapperExtensions.Test.Maps/DapperExtensions.Test.Maps.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net461;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net461;net5.0;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -11,12 +11,12 @@

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="MySql.Data" Version="8.0.24" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="MySql.Data" Version="8.0.28" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="ReportGenerator" Version="4.8.8" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.15.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="ReportGenerator" Version="5.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
61 changes: 45 additions & 16 deletions DapperExtensions.Test/DapperExtensions.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net461;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net461;net5.0;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<RuntimeIdentifiers>win;osx;linux</RuntimeIdentifiers>
<LangVersion>8.0</LangVersion>
Expand All @@ -19,7 +19,24 @@
<PropertyGroup Condition="'$(IsLinux)'=='true'">
<DefineConstants>Linux</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
<DefineConstants>NETFULL</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' OR '$(TargetFramework)' == 'netcoreapp2.1' ">
<DefineConstants>NETCORE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0'">
<DefineConstants>NET50</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
<DefineConstants>NET60</DefineConstants>
</PropertyGroup>


<!--<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="del $(SolutionDir)dapperTest_*.s* /s /q" />
</Target>-->
Expand All @@ -42,43 +59,54 @@
</PropertyGroup> -->

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<PackageReference Include="coverlet.msbuild" Version="3.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="16.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="17.1.0" />
<PackageReference Include="Newtonsoft.Json" version="13.0.1" />
<PackageReference Include="Moq" version="4.16.1" />
<PackageReference Include="MySql.Data" version="8.0.24" />
<PackageReference Include="MySql.Data" version="8.0.28" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="ReportGenerator" Version="4.8.8" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.15.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="ReportGenerator" Version="5.0.4" />
<PackageReference Include="Slapper.AutoMapper" Version="2.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="Dapper" Version="2.0.90" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="Dapper" Version="2.0.123" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net461'">
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="2.19.110" />
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
<PackageReference Include="System.Data.SQLite.Core" version="1.0.114.3" />
<PackageReference Include="IBM.Data.DB2.Core" Version="2.2.0.100" />
<PackageReference Include="System.Data.SQLite.Core" version="1.0.115.5" />

<!--
<PackageReference Include="IBM.Data.DB2.Core-lnx" Version="2.2.0.100" Condition="'$(OS)' == 'WINDOWS_NT'"/>
<PackageReference Include="IBM.Data.DB2.Core" Version="2.2.0.100" Condition="'$(OS)' == 'WINDOWS_NT'"/>
<PackageReference Include="IBM.Data.DB2.Core-lnx" Version="2.2.0.100" Condition="'$(OSTYPE)' == 'linux-gnu'" />
<PackageReference Include="IBM.Data.DB2.Core-osx" Version="2.2.0.100" Condition="'$(OSTYPE)' == 'darwin18'"/>
-->
</ItemGroup>

<ItemGroup Condition="$(DefineConstants.Contains('NETCORE'))">
<PackageReference Include="IBM.Data.DB2.Core" Version="2.2.0.100" />
</ItemGroup>

<ItemGroup Condition="$(DefineConstants.Contains('NET50'))">
<PackageReference Include="Net5.IBM.Data.DB2" Version="5.0.0.500" />
</ItemGroup>

<ItemGroup Condition="$(DefineConstants.Contains('NET60'))">
<PackageReference Include="Net.IBM.Data.DB2" Version="5.0.0.500" />
</ItemGroup>

<!--<ItemGroup Condition="'$(TargetFramework)' != 'net461' and $(IsWindows) == true ">
<PackageReference Include="IBM.Data.DB2.Core-lnx" version="2.2.0.100" />
</ItemGroup>
Expand Down Expand Up @@ -117,8 +145,9 @@

<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<PackageReference Include="Oracle.ManagedDataAccess" version="19.11.0" targetFramework="net461" />
<PackageReference Include="System.Data.SQLite" version="1.0.114.3" targetFramework="net461" />
<PackageReference Include="System.Data.SQLite" version="1.0.115.5" targetFramework="net461" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
<PackageReference Include="IBM.Data.DB.Provider" version="11.5.5010.4" targetFramework="net461" />
<!--<PackageReference Include="Microsoft.SqlServer.Compact" version="4.0.8876.1" />-->
</ItemGroup>

Expand Down Expand Up @@ -157,7 +186,7 @@
</ItemGroup>-->

<!--<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<Reference Include="IBM.Data.DB2">
<Reference Include="IBM.Data.DB2-lnx">
<HintPath>..\..\..\..\..\Program Files\IBM\IBM DATA SERVER DRIVER\bin\netf40\IBM.Data.DB2.dll</HintPath>
</Reference>
</ItemGroup>-->
Expand Down
2 changes: 1 addition & 1 deletion DapperExtensions.Test/Data/Common/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class PersonMapper : ClassMapper<Person>
public PersonMapper()
{
TableName = nameof(Person);
Map(m => m.Phones).Ignore();
//Map(m => m.Phones).Ignore();
AutoMap();
}
}
Expand Down
2 changes: 1 addition & 1 deletion DapperExtensions.Test/Data/DB2/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public PersonMapper()
Map(p => p.LastName).Column("LASTNAME");
Map(p => p.DateCreated).Column("DATECREATED");
Map(p => p.Active).Column("ACTIVE");
Map(p => p.Phones).Ignore();
//Map(p => p.Phones).Ignore();
}
}
}
2 changes: 1 addition & 1 deletion DapperExtensions.Test/Data/Oracle/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public PersonOraMap()
{
Table("Person");
Map(x => x.Id).Key(KeyType.TriggerIdentity);
Map(x => x.Phones).Ignore();
//Map(x => x.Phones).Ignore();
AutoMap();
}
}
Expand Down
2 changes: 1 addition & 1 deletion DapperExtensions.Test/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static string RemoveLineEndings(this string value)
{
return value;
}

string lineSeparator = ((char)0x2028).ToString();
string paragraphSeparator = ((char)0x2029).ToString();

Expand Down
17 changes: 14 additions & 3 deletions DapperExtensions.Test/IntegrationTests/Async/DB2/CrudFixture.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#if NETCOREAPP
using DapperExtensions.Predicate;
using DapperExtensions.Test.Data.DB2;
using DapperExtensions.Test.IntegrationTests.Interfaces;
using FluentAssertions;
using NUnit.Framework;
using System;
Expand All @@ -15,7 +16,7 @@ namespace DapperExtensions.Test.IntegrationTests.Async.DB2
public static class CrudFixture
{
[TestFixture]
public class InsertMethod : DB2BaseAsyncFixture
public class InsertMethod : DB2BaseAsyncFixture, IInsertMethod
{
[Test]
public void AddsEntityToDatabase_ReturnsKey()
Expand Down Expand Up @@ -62,10 +63,20 @@ public void AddsMultipleEntitiesToDatabase()
Assert.AreEqual(3, animals.Count);
Dispose();
}

public void AddsEntityToDatabase_WithPassedInGuid()
{
throw new NotImplementedException();
}

public void AddsMultipleEntitiesToDatabase_WithPassedInGuid()
{
throw new NotImplementedException();
}
}

[TestFixture]
public class GetMethod : DB2BaseAsyncFixture
public class GetMethod : DB2BaseAsyncFixture, IGetMethod
{
[Test]
public void UsingKey_ReturnsEntity()
Expand Down Expand Up @@ -101,7 +112,7 @@ public void UsingCompositeKey_ReturnsEntity()
}

[TestFixture]
public class DeleteMethod : DB2BaseAsyncFixture
public class DeleteMethod : DB2BaseAsyncFixture, IDeleteMethod
{
private static void Arrange(out Person p1, out Person p2, out Person p3)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#if NETCOREAPP
using Dapper;
using DapperExtensions.Sql;
#if NET50
using IBM.Data.Db2;
#elif NET60
using IBM.Data.Db2;
#else
using IBM.Data.DB2.Core;
#endif
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Data;

namespace DapperExtensions.Test.IntegrationTests.Async.DB2
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DapperExtensions.Predicate;
using DapperExtensions.Test.Data.Common;
using DapperExtensions.Test.IntegrationTests.Interfaces;
using FluentAssertions;
using NUnit.Framework;
using System;
Expand All @@ -14,7 +15,7 @@ namespace DapperExtensions.Test.IntegrationTests.Async.MySql
public static class CrudFixture
{
[TestFixture]
public class InsertMethod : MySqlBaseAsyncFixture
public class InsertMethod : MySqlBaseAsyncFixture, IInsertMethod
{
[Test]
public void AddsEntityToDatabase_ReturnsKey()
Expand Down Expand Up @@ -97,7 +98,7 @@ public void AddsMultipleEntitiesToDatabase_WithPassedInGuid()
}

[TestFixture]
public class GetMethod : MySqlBaseAsyncFixture
public class GetMethod : MySqlBaseAsyncFixture, IGetMethod
{
[Test]
public void UsingKey_ReturnsEntity()
Expand Down Expand Up @@ -137,7 +138,7 @@ public void UsingCompositeKey_ReturnsEntity()
}

[TestFixture]
public class DeleteMethod : MySqlBaseAsyncFixture
public class DeleteMethod : MySqlBaseAsyncFixture, IDeleteMethod
{
private void PersonArrange()
{
Expand Down
Loading

0 comments on commit 788878a

Please sign in to comment.