Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Efcore.Pg
提交
65d1542b
E
Efcore.Pg
项目概览
jobily
/
Efcore.Pg
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Efcore.Pg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
65d1542b
编写于
5月 14, 2016
作者:
S
Shay Rojansky
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hstore tests
Related to #25
上级
3f115b44
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
4 deletion
+26
-4
test/Npgsql.EntityFrameworkCore.PostgreSQL.FunctionalTests/BuiltInDataTypesNpgsqlFixture.cs
...stgreSQL.FunctionalTests/BuiltInDataTypesNpgsqlFixture.cs
+8
-0
test/Npgsql.EntityFrameworkCore.PostgreSQL.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs
....PostgreSQL.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs
+18
-4
未找到文件。
test/Npgsql.EntityFrameworkCore.PostgreSQL.FunctionalTests/BuiltInDataTypesNpgsqlFixture.cs
浏览文件 @
65d1542b
...
...
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net.NetworkInformation
;
using
System.Reflection
;
...
...
@@ -25,6 +26,11 @@ public BuiltInDataTypesNpgsqlFixture()
{
_testStore
=
NpgsqlTestStore
.
CreateScratch
();
// TODO: find a better way to do this
_testStore
.
ExecuteNonQuery
(
"CREATE EXTENSION hstore"
);
var
npgsqlConn
=
(
NpgsqlConnection
)
_testStore
.
Connection
;
npgsqlConn
.
ReloadTypes
();
/*
_testStore.ExecuteNonQuery("CREATE TYPE some_composite AS (some_number int, some_text text)");
var npgsqlConn = (NpgsqlConnection)_testStore.Connection;
...
...
@@ -197,6 +203,7 @@ public class MappedDataTypes
public
PhysicalAddress
Macaddr
{
get
;
set
;
}
public
NpgsqlPoint
Point
{
get
;
set
;
}
public
string
Jsonb
{
get
;
set
;
}
public
Dictionary
<
string
,
string
>
Hstore
{
get
;
set
;
}
// Composite
//public SomeComposite SomeComposite { get; set; }
...
...
@@ -274,6 +281,7 @@ public class MappedNullableDataTypes
public
PhysicalAddress
Macaddr
{
get
;
set
;
}
public
NpgsqlPoint
?
Point
{
get
;
set
;
}
public
string
Jsonb
{
get
;
set
;
}
public
Dictionary
<
string
,
string
>
Hstore
{
get
;
set
;
}
// Composite
//public SomeComposite SomeComposite { get; set; }
...
...
test/Npgsql.EntityFrameworkCore.PostgreSQL.FunctionalTests/BuiltInDataTypesNpgsqlTest.cs
浏览文件 @
65d1542b
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net.NetworkInformation
;
using
Microsoft.EntityFrameworkCore.Specification.Tests
;
...
...
@@ -47,6 +48,7 @@ public virtual void Can_query_using_any_mapped_data_type()
Macaddr
=
PhysicalAddress
.
Parse
(
"08-00-2B-01-02-03"
),
Point
=
new
NpgsqlPoint
(
5.2
,
3.3
),
Jsonb
=
@"{""a"": ""b""}"
,
Hstore
=
new
Dictionary
<
string
,
string
>
{
{
"a"
,
"b"
}
},
//SomeComposite = new SomeComposite { SomeNumber = 8, SomeText = "foo" }
});
...
...
@@ -120,7 +122,11 @@ public virtual void Can_query_using_any_mapped_data_type()
//var param20 = @"{""a"": ""b""}";
//Assert.Same(entity, context.Set<MappedNullableDataTypes>().Single(e => e.Int == 999 && e.Jsonb == param20));
//SomeComposite param21 = new SomeComposite { SomeNumber = 8, SomeText = "foo" };
// The following fails because of https://github.com/aspnet/EntityFramework/issues/5365
// var param21 = new Dictionary<string, string> { { "a", "b" } };
// Assert.Same(entity, context.Set<MappedNullableDataTypes>().Single(e => e.Int == 999 && e.Hstore == param21));
//SomeComposite param22 = new SomeComposite { SomeNumber = 8, SomeText = "foo" };
//Assert.Same(entity, context.Set<MappedNullableDataTypes>().Single(e => e.Int == 999 && e.SomeComposite.Equals(param20)));
}
}
...
...
@@ -203,7 +209,10 @@ public virtual void Can_query_using_any_mapped_data_types_with_nulls()
string
param20
=
null
;
Assert
.
Same
(
entity
,
context
.
Set
<
MappedNullableDataTypes
>().
Single
(
e
=>
e
.
Int
==
911
&&
e
.
Jsonb
==
param20
));
//SomeComposite param21 = null;
Dictionary
<
string
,
string
>
param21
=
null
;
Assert
.
Same
(
entity
,
context
.
Set
<
MappedNullableDataTypes
>().
Single
(
e
=>
e
.
Int
==
911
&&
e
.
Hstore
==
param21
));
//SomeComposite param22 = null;
//Assert.Same(entity, context.Set<MappedNullableDataTypes>().Single(e => e.Int == 911 && e.SomeComposite == param20));
}
}
...
...
@@ -241,9 +250,10 @@ public virtual void Can_insert_and_read_back_all_mapped_data_types()
Macaddr
=
PhysicalAddress
.
Parse
(
"08-00-2B-01-02-03"
),
Point
=
new
NpgsqlPoint
(
5.2
,
3.3
),
Jsonb
=
@"{""a"": ""b""}"
,
Hstore
=
new
Dictionary
<
string
,
string
>
{
{
"a"
,
"b"
}
},
//SomeComposite = new SomeComposite { SomeNumber = 8, SomeText = "foo" }
});
//SomeComposite = new SomeComposite { SomeNumber = 8, SomeText = "foo" }
});
Assert
.
Equal
(
1
,
context
.
SaveChanges
());
}
...
...
@@ -277,6 +287,7 @@ public virtual void Can_insert_and_read_back_all_mapped_data_types()
Assert
.
Equal
(
PhysicalAddress
.
Parse
(
"08-00-2B-01-02-03"
),
entity
.
Macaddr
);
Assert
.
Equal
(
new
NpgsqlPoint
(
5.2
,
3.3
),
entity
.
Point
);
Assert
.
Equal
(
@"{""a"": ""b""}"
,
entity
.
Jsonb
);
Assert
.
Equal
(
new
Dictionary
<
string
,
string
>
{
{
"a"
,
"b"
}
},
entity
.
Hstore
);
//Assert.Equal(new SomeComposite { SomeNumber = 8, SomeText = "foo" }, entity.SomeComposite);
}
...
...
@@ -315,6 +326,7 @@ public virtual void Can_insert_and_read_back_all_mapped_nullable_data_types()
Macaddr
=
PhysicalAddress
.
Parse
(
"08-00-2B-01-02-03"
),
Point
=
new
NpgsqlPoint
(
5.2
,
3.3
),
Jsonb
=
@"{""a"": ""b""}"
,
Hstore
=
new
Dictionary
<
string
,
string
>
{
{
"a"
,
"b"
}
},
//SomeComposite = new SomeComposite { SomeNumber = 8, SomeText = "foo" }
});
...
...
@@ -351,6 +363,7 @@ public virtual void Can_insert_and_read_back_all_mapped_nullable_data_types()
Assert
.
Equal
(
PhysicalAddress
.
Parse
(
"08-00-2B-01-02-03"
),
entity
.
Macaddr
);
Assert
.
Equal
(
new
NpgsqlPoint
(
5.2
,
3.3
),
entity
.
Point
);
Assert
.
Equal
(
@"{""a"": ""b""}"
,
entity
.
Jsonb
);
Assert
.
Equal
(
new
Dictionary
<
string
,
string
>
{
{
"a"
,
"b"
}
},
entity
.
Hstore
);
//Assert.Equal(new SomeComposite { SomeNumber = 8, SomeText = "foo" }, entity.SomeComposite);
}
...
...
@@ -398,6 +411,7 @@ public virtual void Can_insert_and_read_back_all_mapped_data_types_set_to_null()
Assert
.
Null
(
entity
.
Macaddr
);
Assert
.
Null
(
entity
.
Point
);
Assert
.
Null
(
entity
.
Jsonb
);
Assert
.
Null
(
entity
.
Hstore
);
//Assert.Null(entity.SomeComposite);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录