File tree Expand file tree Collapse file tree 4 files changed +129
-0
lines changed Expand file tree Collapse file tree 4 files changed +129
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+
4
+ namespace NHibernate . Test . NHSpecificTest . NH3590
5
+ {
6
+ public class Entity
7
+ {
8
+ public Entity ( )
9
+ {
10
+ Dates = new HashSet < DateTime > ( ) ;
11
+ }
12
+
13
+ public virtual Guid Id { get ; protected set ; }
14
+ public virtual ISet < DateTime > Dates { get ; protected set ; }
15
+
16
+ public override bool Equals ( object obj )
17
+ {
18
+ var that = obj as Entity ;
19
+ return that != null && that . Id == Id ;
20
+ }
21
+
22
+ public override int GetHashCode ( )
23
+ {
24
+ return Id . GetHashCode ( ) ;
25
+ }
26
+ }
27
+ }
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using NUnit . Framework ;
3
+ using SharpTestsEx ;
4
+
5
+ namespace NHibernate . Test . NHSpecificTest . NH3590
6
+ {
7
+ [ TestFixture ]
8
+ public class Fixture : BugTestCase
9
+ {
10
+ private Entity entity ;
11
+
12
+ protected override void OnSetUp ( )
13
+ {
14
+ entity = new Entity ( ) ;
15
+ using ( var s = OpenSession ( ) )
16
+ {
17
+ using ( var tx = s . BeginTransaction ( ) )
18
+ {
19
+ s . Save ( entity ) ;
20
+ tx . Commit ( ) ;
21
+ }
22
+ }
23
+ }
24
+
25
+ [ Test ]
26
+ public void ShouldUpdate ( )
27
+ {
28
+ entity . Dates . Add ( DateTime . Now ) ;
29
+ using ( var s = OpenSession ( ) )
30
+ {
31
+ using ( var tx = s . BeginTransaction ( ) )
32
+ {
33
+ s . Update ( entity ) ;
34
+ tx . Commit ( ) ;
35
+ }
36
+ }
37
+
38
+ using ( var s = OpenSession ( ) )
39
+ {
40
+ using ( s . BeginTransaction ( ) )
41
+ {
42
+ s . Get < Entity > ( entity . Id ) . Dates . Count
43
+ . Should ( ) . Be . EqualTo ( 1 ) ;
44
+ }
45
+ }
46
+ }
47
+
48
+ [ Test ]
49
+ public void ShouldMerge ( )
50
+ {
51
+ entity . Dates . Add ( DateTime . Now ) ;
52
+ using ( var s = OpenSession ( ) )
53
+ {
54
+ using ( var tx = s . BeginTransaction ( ) )
55
+ {
56
+ s . Merge ( entity ) ;
57
+ tx . Commit ( ) ;
58
+ }
59
+ }
60
+
61
+ using ( var s = OpenSession ( ) )
62
+ {
63
+ using ( s . BeginTransaction ( ) )
64
+ {
65
+ s . Get < Entity > ( entity . Id ) . Dates . Count
66
+ . Should ( ) . Be . EqualTo ( 1 ) ;
67
+ }
68
+ }
69
+ }
70
+
71
+ protected override void OnTearDown ( )
72
+ {
73
+ using ( var s = OpenSession ( ) )
74
+ {
75
+ using ( var tx = s . BeginTransaction ( ) )
76
+ {
77
+ s . Delete ( s . Get < Entity > ( entity . Id ) ) ;
78
+ tx . Commit ( ) ;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <hibernate-mapping xmlns =" urn:nhibernate-mapping-2.2"
3
+ namespace =" NHibernate.Test.NHSpecificTest.NH3590"
4
+ assembly =" NHibernate.Test" >
5
+
6
+ <class name =" Entity" >
7
+ <id name =" Id"
8
+ type =" guid" >
9
+ <generator class =" guid.comb" />
10
+ </id >
11
+ <set name =" Dates" >
12
+ <key column =" entity_id" />
13
+ <element column =" Date" type =" DateTime" />
14
+ </set >
15
+ </class >
16
+ </hibernate-mapping >
Original file line number Diff line number Diff line change 1155
1155
<Compile Include =" NHSpecificTest\ProxyValidator\ShouldBeProxiableTests.cs" />
1156
1156
<Compile Include =" NHSpecificTest\NH2898\ItemWithLazyProperty.cs" />
1157
1157
<Compile Include =" NHSpecificTest\NH2898\Fixture.cs" />
1158
+ <Compile Include =" NHSpecificTest\NH3590\Entity.cs" />
1159
+ <Compile Include =" NHSpecificTest\NH3590\Fixture.cs" />
1158
1160
<Compile Include =" NHSpecificTest\SqlConverterAndMultiQuery\Fixture.cs" />
1159
1161
<Compile Include =" NHSpecificTest\SqlConverterAndMultiQuery\Model.cs" />
1160
1162
<Compile Include =" NHSpecificTest\SqlConverterAndMultiQuery\SqlConverter.cs" />
3009
3011
<EmbeddedResource Include =" NHSpecificTest\NH1291AnonExample\Mappings.hbm.xml" />
3010
3012
</ItemGroup >
3011
3013
<ItemGroup >
3014
+ <EmbeddedResource Include =" NHSpecificTest\NH3590\Mappings.hbm.xml" />
3012
3015
<EmbeddedResource Include =" NHSpecificTest\NH3377\Mappings.hbm.xml" />
3013
3016
<EmbeddedResource Include =" NHSpecificTest\NH2865\Mappings.hbm.xml" />
3014
3017
<EmbeddedResource Include =" NHSpecificTest\NH2756\Mappings.hbm.xml" />
You can’t perform that action at this time.
0 commit comments