forked from DapperLib/Dapper
-
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.
- Loading branch information
1 parent
3081cd7
commit 2f7125a
Showing
19 changed files
with
765 additions
and
60 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | ||
</startup> | ||
</configuration> |
83 changes: 83 additions & 0 deletions
83
Dapper.Contrib.MsSqlTests NET45/Dapper.Contrib.MsSqlTests NET45.csproj
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{E5482A3B-2C2A-4907-9804-C191F18FA622}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Dapper.Contrib.Tests</RootNamespace> | ||
<AssemblyName>Dapper.Contrib.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>TRACE;DEBUG;MSSQL</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" /> | ||
<Reference Include="System.Transactions" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="..\Dapper.Contrib.Tests NET45\TestsAsync.cs"> | ||
<Link>TestsAsync.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Dapper.Contrib.Tests\Assert.cs"> | ||
<Link>Assert.cs</Link> | ||
</Compile> | ||
<Compile Include="..\Dapper.Contrib.Tests\Tests.cs"> | ||
<Link>Tests.cs</Link> | ||
</Compile> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Dapper NET45\Dapper NET45.csproj"> | ||
<Project>{0fff5bc7-0a4b-4d87-835e-4fad70937507}</Project> | ||
<Name>Dapper NET45</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Dapper.Contrib NET45\Dapper.Contrib NET45.csproj"> | ||
<Project>{302ec82f-a81b-48c5-b653-b5c75d2bd103}</Project> | ||
<Name>Dapper.Contrib NET45</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Dapper.SqlBuilder\Dapper.SqlBuilder.csproj"> | ||
<Project>{bf782ef1-2b0f-42fa-9dd0-928454a94c6d}</Project> | ||
<Name>Dapper.SqlBuilder</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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 |
---|---|---|
@@ -0,0 +1,98 @@ | ||
using System; | ||
using System.Data.SqlClient; | ||
using System.Data.SqlServerCe; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
|
||
namespace Dapper.Contrib.Tests | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
SetupMsSqlDatabase(); | ||
SetupTables(); | ||
RunTests(); | ||
DropTables(); | ||
SetupTables(); | ||
RunAsyncTests(); | ||
Console.WriteLine("Press any key..."); | ||
Console.ReadKey(); | ||
} | ||
|
||
private static void SetupMsSqlDatabase() | ||
{ | ||
using (var connection = new SqlConnection("Data Source = .\\SQLEXPRESS;Initial Catalog=master;Integrated Security=SSPI")) | ||
{ | ||
connection.Open(); | ||
var exists = connection.Query<int>("SELECT count(*) FROM master.sys.databases WHERE name = @name", | ||
new { name = "DapperContribMsSqlTests" }).First(); | ||
if (exists > 0) | ||
{ | ||
connection.Execute("drop database DapperContribMsSqlTests"); | ||
} | ||
connection.Execute("create database DapperContribMsSqlTests"); | ||
|
||
} | ||
} | ||
|
||
private static void DropTables() | ||
{ | ||
|
||
using (var connection = new SqlConnection("Data Source = .\\SQLEXPRESS;Initial Catalog=DapperContribMsSqlTests;Integrated Security=SSPI")) | ||
{ | ||
connection.Open(); | ||
connection.Execute("alter database DapperContribMsSqlTests set single_user with rollback immediate"); | ||
connection.Execute(@" drop table Stuff"); | ||
connection.Execute(@" drop table People "); | ||
connection.Execute(@" drop table Users"); | ||
connection.Execute(@" drop table Automobiles "); | ||
connection.Execute(@" drop table Results "); | ||
connection.Execute(@" drop table ObjectX "); | ||
connection.Execute(@" drop table ObjectY "); | ||
} | ||
Console.WriteLine("Created database"); | ||
} | ||
|
||
private static void SetupTables() | ||
{ | ||
|
||
using (var connection = new SqlConnection("Data Source = .\\SQLEXPRESS;Initial Catalog=DapperContribMsSqlTests;Integrated Security=SSPI")) | ||
{ | ||
connection.Open(); | ||
connection.Execute(@" create table Stuff (TheId int IDENTITY(1,1) not null, Name nvarchar(100) not null, Created DateTime null) "); | ||
connection.Execute(@" create table People (Id int IDENTITY(1,1) not null, Name nvarchar(100) not null) "); | ||
connection.Execute(@" create table Users (Id int IDENTITY(1,1) not null, Name nvarchar(100) not null, Age int not null) "); | ||
connection.Execute(@" create table Automobiles (Id int IDENTITY(1,1) not null, Name nvarchar(100) not null) "); | ||
connection.Execute(@" create table Results (Id int IDENTITY(1,1) not null, Name nvarchar(100) not null, [Order] int not null) "); | ||
connection.Execute(@" create table ObjectX (ObjectXId nvarchar(100) not null, Name nvarchar(100) not null) "); | ||
connection.Execute(@" create table ObjectY (ObjectYId int not null, Name nvarchar(100) not null) "); | ||
} | ||
Console.WriteLine("Created database"); | ||
} | ||
|
||
private static void RunTests() | ||
{ | ||
var tester = new Tests(); | ||
foreach (var method in typeof(Tests).GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) | ||
{ | ||
Console.Write("Running " + method.Name); | ||
method.Invoke(tester, null); | ||
Console.WriteLine(" - OK!"); | ||
} | ||
} | ||
|
||
private static void RunAsyncTests() | ||
{ | ||
var tester = new TestsAsync(); | ||
foreach (var method in typeof(TestsAsync).GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) | ||
{ | ||
Console.Write("Running " + method.Name); | ||
Task.WaitAll((Task)method.Invoke(tester, null)); | ||
Console.WriteLine(" - OK!"); | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Dapper.Contrib.MsSqlTests NET45/Properties/AssemblyInfo.cs
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Dapper.Contrib.Tests NET45")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Dapper.Contrib.Tests NET45")] | ||
[assembly: AssemblyCopyright("Copyright © 2014")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("2d6cdd3d-b94b-4cd4-842a-60c6e4c93c5c")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Oops, something went wrong.