Commit a4bb66de authored by Marc Gravell's avatar Marc Gravell

Test cleanup; enable lots more tests hidden previously as EXTERNALS

parent 19afe1ed
#if EXTERNALS #if ENTITY_FRAMEWORK
using System.Data.Common; using System.Data.Common;
using System.Data.Entity; using System.Data.Entity;
......
#if EXTERNALS #if NHIBERNATE
using NHibernate; using NHibernate;
using NHibernate.Cfg; using NHibernate.Cfg;
......
This diff is collapsed.
...@@ -2,13 +2,15 @@ ...@@ -2,13 +2,15 @@
namespace Dapper.Tests namespace Dapper.Tests
{ {
#if EXTERNALS #if ORMLITE
[ServiceStack.DataAnnotations.Alias("Posts")] [ServiceStack.DataAnnotations.Alias("Posts")]
[Soma.Core.Table(Name = "Posts")] #endif
#if SOMA
[Soma.Core.Table(Name = "Posts")]
#endif #endif
public class Post public class Post
{ {
#if EXTERNALS #if SOMA
[Soma.Core.Id(Soma.Core.IdKind.Identity)] [Soma.Core.Id(Soma.Core.IdKind.Identity)]
#endif #endif
public int Id { get; set; } public int Id { get; set; }
......
...@@ -192,7 +192,7 @@ public async Task TestMultiClosedConnAsyncViaFirstOrDefault() ...@@ -192,7 +192,7 @@ public async Task TestMultiClosedConnAsyncViaFirstOrDefault()
} }
} }
#if EXTERNALS #if !COREFX
[Fact] [Fact]
public async Task ExecuteReaderOpenAsync() public async Task ExecuteReaderOpenAsync()
{ {
......
...@@ -114,7 +114,7 @@ public bool GetWentThroughProperConstructor() ...@@ -114,7 +114,7 @@ public bool GetWentThroughProperConstructor()
} }
} }
#if EXTERNALS #if LINQ2SQL
class NoDefaultConstructorWithBinary class NoDefaultConstructorWithBinary
{ {
public System.Data.Linq.Binary Value { get; set; } public System.Data.Linq.Binary Value { get; set; }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
using System.Linq; using System.Linq;
using Xunit; using Xunit;
#if EXTERNALS #if ENTITY_FRAMEWORK
using System.Data.Entity.Spatial; using System.Data.Entity.Spatial;
using Microsoft.SqlServer.Types; using Microsoft.SqlServer.Types;
#endif #endif
...@@ -114,7 +114,7 @@ public void AddParameter(IDbCommand command, string name) ...@@ -114,7 +114,7 @@ public void AddParameter(IDbCommand command, string name)
} }
#if EXTERNALS #if !COREFX
[Fact] [Fact]
public void TestTVPWithAnonymousObject() public void TestTVPWithAnonymousObject()
{ {
...@@ -346,7 +346,9 @@ public void DataTableParametersWithExtendedProperty() ...@@ -346,7 +346,9 @@ public void DataTableParametersWithExtendedProperty()
ex.Message.Equals("The table type parameter 'ids' must have a valid type name."); ex.Message.Equals("The table type parameter 'ids' must have a valid type name.");
} }
} }
#endif
#if !COREFX
[Fact] [Fact]
public void SupportInit() public void SupportInit()
{ {
...@@ -354,7 +356,9 @@ public void SupportInit() ...@@ -354,7 +356,9 @@ public void SupportInit()
obj.Value.Equals("abc"); obj.Value.Equals("abc");
obj.Flags.Equals(31); obj.Flags.Equals(31);
} }
#endif
#if ENTITY_FRAMEWORK
class HazGeo class HazGeo
{ {
public int Id { get; set; } public int Id { get; set; }
...@@ -444,7 +448,11 @@ public class HazSqlHierarchy ...@@ -444,7 +448,11 @@ public class HazSqlHierarchy
public int Id { get; set; } public int Id { get; set; }
public SqlHierarchyId Path { get; set; } public SqlHierarchyId Path { get; set; }
} }
#endif
#if OLEDB
// see http://stackoverflow.com/q/18847510/23354 // see http://stackoverflow.com/q/18847510/23354
[Fact] [Fact]
public void TestOleDbParameters() public void TestOleDbParameters()
......
...@@ -26,16 +26,20 @@ ...@@ -26,16 +26,20 @@
using System.Diagnostics; using System.Diagnostics;
using Xunit; using Xunit;
using System.Data.Common; using System.Data.Common;
#if EXTERNALS #if FIREBIRD
using FirebirdSql.Data.FirebirdClient; using FirebirdSql.Data.FirebirdClient;
#endif
#if ENTITY_FRAMEWORK
using System.Data.Entity.Spatial; using System.Data.Entity.Spatial;
using Microsoft.SqlServer.Types; using Microsoft.SqlServer.Types;
#endif
#if SQL_CE
using System.Data.SqlServerCe; using System.Data.SqlServerCe;
#endif
using SqlServerTypes; using SqlServerTypes;
#if POSTGRESQL #if POSTGRESQL
using Npgsql; using Npgsql;
#endif #endif
#endif
#if COREFX #if COREFX
namespace System.ComponentModel { namespace System.ComponentModel {
...@@ -116,10 +120,16 @@ static TestSuite() ...@@ -116,10 +120,16 @@ static TestSuite()
#endif #endif
Console.WriteLine("Dapper: " + typeof(SqlMapper).AssemblyQualifiedName); Console.WriteLine("Dapper: " + typeof(SqlMapper).AssemblyQualifiedName);
Console.WriteLine("Using Connectionstring: {0}", ConnectionString); Console.WriteLine("Using Connectionstring: {0}", ConnectionString);
#if EXTERNALS && !DNX #if !COREFX
Console.Write("Loading native assemblies for SQL types..."); Console.Write("Loading native assemblies for SQL types...");
Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory); try {
Console.WriteLine("done."); Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
Console.WriteLine("done.");
} catch(Exception ex)
{
Console.WriteLine("failed.");
Console.Error.WriteLine(ex.Message);
}
#endif #endif
} }
...@@ -726,7 +736,7 @@ public void TestInheritance() ...@@ -726,7 +736,7 @@ public void TestInheritance()
list.First().Base2.IsEqualTo("Four"); list.First().Base2.IsEqualTo("Four");
} }
#if EXTERNALS #if !COREFX
[Fact] [Fact]
public void ExecuteReader() public void ExecuteReader()
{ {
...@@ -739,7 +749,9 @@ public void ExecuteReader() ...@@ -739,7 +749,9 @@ public void ExecuteReader()
((int)dt.Rows[0][0]).IsEqualTo(3); ((int)dt.Rows[0][0]).IsEqualTo(3);
((int)dt.Rows[0][1]).IsEqualTo(4); ((int)dt.Rows[0][1]).IsEqualTo(4);
} }
#endif
#if SQL_CE
[Fact] [Fact]
public void MultiRSSqlCE() public void MultiRSSqlCE()
{ {
...@@ -784,7 +796,8 @@ public class AuthorCE ...@@ -784,7 +796,8 @@ public class AuthorCE
public int ID { get; set; } public int ID { get; set; }
public string Name { get; set; } public string Name { get; set; }
} }
#endif
#if LINQ2SQL
[Fact] [Fact]
public void TestLinqBinaryToClass() public void TestLinqBinaryToClass()
{ {
...@@ -2226,7 +2239,7 @@ public void SO24605346_ProcsAndStrings() ...@@ -2226,7 +2239,7 @@ public void SO24605346_ProcsAndStrings()
class PracticeRebateOrders class PracticeRebateOrders
{ {
public string fTaxInvoiceNumber; public string fTaxInvoiceNumber;
#if EXTERNALS #if !COREFX
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
#endif #endif
public string TaxInvoiceNumber { get { return fTaxInvoiceNumber; } set { fTaxInvoiceNumber = value; } } public string TaxInvoiceNumber { get { return fTaxInvoiceNumber; } set { fTaxInvoiceNumber = value; } }
...@@ -2385,7 +2398,7 @@ public void Issue22_ExecuteScalar() ...@@ -2385,7 +2398,7 @@ public void Issue22_ExecuteScalar()
int? k = connection.ExecuteScalar<int?>("select @i", new { i = default(int?) }); int? k = connection.ExecuteScalar<int?>("select @i", new { i = default(int?) });
k.IsNull(); k.IsNull();
#if EXTERNALS #if ENTITY_FRAMEWORK
Dapper.EntityFramework.Handlers.Register(); Dapper.EntityFramework.Handlers.Register();
var geo = DbGeography.LineFromText("LINESTRING(-122.360 47.656, -122.343 47.656 )", 4326); var geo = DbGeography.LineFromText("LINESTRING(-122.360 47.656, -122.343 47.656 )", 4326);
var geo2 = connection.ExecuteScalar<DbGeography>("select @geo", new { geo }); var geo2 = connection.ExecuteScalar<DbGeography>("select @geo", new { geo });
...@@ -3022,7 +3035,7 @@ class Issue295Person ...@@ -3022,7 +3035,7 @@ class Issue295Person
public DateTime? DoB { get; set; } public DateTime? DoB { get; set; }
public DateTime? DoB2 { get; set; } public DateTime? DoB2 { get; set; }
} }
#if EXTERNALS #if FIREBIRD
[Fact(Skip="Bug in Firebird; a PR to fix it has been submitted")] [Fact(Skip="Bug in Firebird; a PR to fix it has been submitted")]
public void Issue178_Firebird() public void Issue178_Firebird()
{ {
...@@ -3059,7 +3072,9 @@ public void Issue178_Firebird() ...@@ -3059,7 +3072,9 @@ public void Issue178_Firebird()
count.IsEqualTo(1); count.IsEqualTo(1);
} }
} }
#endif
#if OLEDB
[Fact] [Fact]
public void PseudoPositionalParameters_Simple() public void PseudoPositionalParameters_Simple()
{ {
...@@ -3204,9 +3219,9 @@ class Cat ...@@ -3204,9 +3219,9 @@ class Cat
}; };
[Fact] [Fact]
public void TestPostresqlArrayParameters() public void TestPostgresqlArrayParameters()
{ {
using (var conn = new NpgsqlConnection("Server=localhost;Port=5432;User Id=dappertest;Password=dapperpass;Database=dappertest;Encoding=UNICODE")) using (var conn = new NpgsqlConnection("Server=localhost;Port=5432;User Id=dappertest;Password=dapperpass;Database=dappertest")) // ;Encoding=UNICODE
{ {
conn.Open(); conn.Open();
IDbTransaction transaction = conn.BeginTransaction(); IDbTransaction transaction = conn.BeginTransaction();
......
...@@ -26,7 +26,18 @@ ...@@ -26,7 +26,18 @@
"frameworks": { "frameworks": {
"net40": { "net40": {
"compilationOptions": { "compilationOptions": {
"define": [ "MYSQL" ] "define": [
"MYSQL",
"ENTITY_FRAMEWORK",
"LINQ2SQL",
"FIREBIRD",
"SQL_CE",
"OLEDB",
"MASSIVE",
"ORMLITE",
"SOMA",
"SIMPLEDATA"
]
}, },
"frameworkAssemblies": { "frameworkAssemblies": {
"System.Configuration": "4.0.0.0", "System.Configuration": "4.0.0.0",
...@@ -35,17 +46,40 @@ ...@@ -35,17 +46,40 @@
"System.Xml": "4.0.0.0" "System.Xml": "4.0.0.0"
}, },
"dependencies": { "dependencies": {
"Dapper.EntityFramework": {
"target": "project"
},
"EntityFramework": "6.1.3",
"FirebirdSql.Data.FirebirdClient": "4.10.0",
"Microsoft.SqlServer.Types": "11.0.2",
"MySql.Data": "6.9.8",
"NHibernate": "4.0.4.4000", "NHibernate": "4.0.4.4000",
"ServiceStack.OrmLite": "4.0.48", "ServiceStack.OrmLite": "4.0.48",
"ServiceStack.OrmLite.SqlServer": "4.0.48", "ServiceStack.OrmLite.SqlServer": "4.0.48",
"Simple.Data.Ado": "1.0.0-rc3",
"Simple.Data.Core": "1.0.0-rc3",
"Simple.Data.SqlServer": "1.0.0-rc3",
"Soma": "1.8.0.7", "Soma": "1.8.0.7",
"xunit": "1.9.2", "System.Data.SqlServerCe_unofficial": "4.0.8482.1",
"MySql.Data": "6.9.8" "xunit": "1.9.2"
} }
}, },
"net45": { "net45": {
"compilationOptions": { "compilationOptions": {
"define": [ "ASYNC", "MYSQL" ] "define": [
"ASYNC",
"MYSQL",
"ENTITY_FRAMEWORK",
"LINQ2SQL",
"FIREBIRD",
"SQL_CE",
"POSTGRESQL",
"OLEDB",
"MASSIVE",
"ORMLITE",
"SOMA",
"SIMPLEDATA"
]
}, },
"frameworkAssemblies": { "frameworkAssemblies": {
"System.Configuration": "4.0.0.0", "System.Configuration": "4.0.0.0",
...@@ -55,12 +89,25 @@ ...@@ -55,12 +89,25 @@
"System.Xml": "4.0.0.0" "System.Xml": "4.0.0.0"
}, },
"dependencies": { "dependencies": {
"Dapper.EntityFramework": {
"target": "project"
},
"EntityFramework": "6.1.3",
"FirebirdSql.Data.FirebirdClient": "4.10.0",
"Microsoft.SqlServer.Types": "11.0.2",
"MySql.Data": "6.9.8",
"NHibernate": "4.0.4.4000", "NHibernate": "4.0.4.4000",
"Npgsql": "3.0.5",
"ServiceStack.OrmLite": "4.0.48", "ServiceStack.OrmLite": "4.0.48",
"ServiceStack.OrmLite.SqlServer": "4.0.48", "ServiceStack.OrmLite.SqlServer": "4.0.48",
"Simple.Data.Ado": "2.0.0-alpha1",
"Simple.Data.Core": "2.0.0-alpha1",
"Simple.Data.SqlServer": "2.0.0-alpha1",
"Soma": "1.8.0.7", "Soma": "1.8.0.7",
"xunit": "2.1.0", "Susanoo.Core": "1.2.4",
"MySql.Data": "6.9.8" "Susanoo.SqlServer": "1.2.4",
"System.Data.SqlServerCe_unofficial": "4.0.8482.1",
"xunit": "2.1.0"
} }
}, },
"dotnet5.4": { "dotnet5.4": {
...@@ -80,37 +127,50 @@ ...@@ -80,37 +127,50 @@
}, },
"dnx451": { "dnx451": {
"compilationOptions": { "compilationOptions": {
"define": [ "ASYNC", "EXTERNALS", "DNX", "MYSQL" ] "define": [
"ASYNC",
"MYSQL",
"ENTITY_FRAMEWORK",
"LINQ2SQL",
"FIREBIRD",
"SQL_CE",
"POSTGRESQL",
"OLEDB",
"MASSIVE",
"ORMLITE",
"SOMA",
"SIMPLEDATA"
]
}, },
"frameworkAssemblies": { "frameworkAssemblies": {
"System.Configuration": "4.0.0.0", "System.Configuration": "4.0.0.0",
"System.Data.Linq": "4.0.0.0" "System.Data": "4.0.0.0",
"System.Data.Linq": "4.0.0.0",
"System.Runtime": "4.0.0.0",
"System.Xml": "4.0.0.0"
}, },
"dependencies": { "dependencies": {
"NHibernate": "4.0.4.4000", "Dapper.EntityFramework": {
"NHibernate.ByteCode.LinFu": "1.1.0", "target": "project"
"NHibernate.ByteCode.Castle": "3.3.3.4000", },
"EntityFramework": "6.1.3", "EntityFramework": "6.1.3",
"FirebirdSql.Data.FirebirdClient": "4.10.0",
"Microsoft.SqlServer.Types": "11.0.2",
"MySql.Data": "6.9.8",
"NHibernate": "4.0.4.4000",
"Npgsql": "3.0.5",
"ServiceStack.OrmLite": "4.0.48", "ServiceStack.OrmLite": "4.0.48",
"ServiceStack.OrmLite.SqlServer": "4.0.48", "ServiceStack.OrmLite.SqlServer": "4.0.48",
"Microsoft.SqlServer.Compact": "4.0.8876.1", "Simple.Data.Ado": "2.0.0-alpha1",
"Microsoft.SqlServer.Types": "11.0.2",
"Npgsql": "2.1.0",
"Soma": "1.8.0.7",
"xunit": "2.1.0",
"xunit.runner.dnx": "2.1.0-*",
"BLToolkit": "4.1.21",
"Susanoo.Core": "0.8.4.36",
"SubSonic": "3.0.0.4",
"Simple.Data.Core": "2.0.0-alpha1", "Simple.Data.Core": "2.0.0-alpha1",
"Simple.Data.SqlServer": "2.0.0-alpha1", "Simple.Data.SqlServer": "2.0.0-alpha1",
"FirebirdSql.Data.FirebirdClient": "4.8.1.1", "Soma": "1.8.0.7",
"Dapper.EntityFramework": { "Susanoo.Core": "1.2.4",
"target": "project" "Susanoo.SqlServer": "1.2.4",
}, "System.Data.SqlServerCe_unofficial": "4.0.8482.1",
"MySql.Data": "6.9.8" "xunit": "2.2.0-beta1-build3239",
"xunit.runner.dnx": "2.1.0-rc1-build204"
} }
}, },
"dnxcore50": { "dnxcore50": {
"compilationOptions": { "compilationOptions": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment