@@ -21,24 +21,8 @@ public abstract class AggregatesProblemTestBase : AutoBuildTest
2121 protected decimal DoubleValueAccuracy { get ; private set ; } = 0.00000000000001m ;
2222 protected decimal DecimalValueAccuracy { get ; private set ; } = 0.00000000000000001m ;
2323
24-
25- protected override Domain BuildDomain ( DomainConfiguration configuration )
26- {
27- var firstTryConfig = configuration . Clone ( ) ;
28- firstTryConfig . UpgradeMode = DomainUpgradeMode . Validate ;
29- try {
30- return base . BuildDomain ( firstTryConfig ) ;
31- }
32- catch ( SchemaSynchronizationException ) { }
33- catch ( Exception ) {
34- throw ;
35- }
36-
37- refillDatabase = true ;
38- var secondTryConfig = configuration . Clone ( ) ;
39- secondTryConfig . UpgradeMode = DomainUpgradeMode . Recreate ;
40- return base . BuildDomain ( secondTryConfig ) ;
41- }
24+ protected Session GlobalSession { get ; private set ; }
25+ protected TransactionScope GlobalTransaction { get ; private set ; }
4226
4327 protected override DomainConfiguration BuildConfiguration ( )
4428 {
@@ -62,93 +46,88 @@ protected override void PopulateData()
6246 DecimalValueAccuracy = 0.00001m ;
6347 }
6448
65- if ( ! refillDatabase )
66- return ;
49+ ( GlobalSession , GlobalTransaction ) = CreateSessionAndTransaction ( ) ;
6750
51+ _ = new TestEntity ( GlobalSession ) {
52+ ByteValue = 2 ,
53+ SByteValue = 4 ,
54+ ShortValue = 8 ,
55+ UShortValue = 9 ,
56+ IntValue = 10 ,
57+ UIntValue = 11 ,
58+ LongValue = 20 ,
59+ ULongValue = 25 ,
60+ FloatValue = 0.1f ,
61+ DecimalValue = 1.2m ,
62+ DoubleValue1 = 2.0 ,
63+ DoubleValue2 = 3.0 ,
64+ NullableByteValue = 2 ,
65+ NullableSByteValue = 4 ,
66+ NullableShortValue = 8 ,
67+ NullableUShortValue = 9 ,
68+ NullableIntValue = 30 ,
69+ NullableUIntValue = 31 ,
70+ NullableLongValue = 40 ,
71+ NullableULongValue = 45 ,
72+ NullableFloatValue = 0.4f ,
73+ NullableDecimalValue = 4.2m ,
74+ NullableDoubleValue1 = 5.0 ,
75+ NullableDoubleValue2 = 6.0
76+ } ;
77+ _ = new TestEntity ( GlobalSession ) {
78+ ByteValue = 3 ,
79+ SByteValue = 5 ,
80+ ShortValue = 9 ,
81+ UShortValue = 10 ,
82+ IntValue = 11 ,
83+ UIntValue = 12 ,
84+ LongValue = 21 ,
85+ ULongValue = 26 ,
86+ FloatValue = 0.2f ,
87+ DecimalValue = 1.3m ,
88+ DoubleValue1 = 2.1 ,
89+ DoubleValue2 = 3.1 ,
90+ NullableByteValue = 3 ,
91+ NullableSByteValue = 5 ,
92+ NullableShortValue = 9 ,
93+ NullableUShortValue = 10 ,
94+ NullableIntValue = 31 ,
95+ NullableUIntValue = 32 ,
96+ NullableLongValue = 41 ,
97+ NullableULongValue = 46 ,
98+ NullableFloatValue = 0.5f ,
99+ NullableDecimalValue = 4.3m ,
100+ NullableDoubleValue1 = 5.1 ,
101+ NullableDoubleValue2 = 6.1
102+ } ;
103+ _ = new TestEntity ( GlobalSession ) {
104+ ByteValue = 4 ,
105+ SByteValue = 6 ,
106+ ShortValue = 10 ,
107+ UShortValue = 11 ,
108+ IntValue = 12 ,
109+ UIntValue = 13 ,
110+ LongValue = 22 ,
111+ ULongValue = 27 ,
112+ FloatValue = 0.3f ,
113+ DecimalValue = 1.4m ,
114+ DoubleValue1 = 2.3 ,
115+ DoubleValue2 = 3.3 ,
116+ NullableByteValue = 4 ,
117+ NullableSByteValue = 6 ,
118+ NullableShortValue = 10 ,
119+ NullableUShortValue = 11 ,
120+ NullableIntValue = 32 ,
121+ NullableUIntValue = 33 ,
122+ NullableLongValue = 42 ,
123+ NullableULongValue = 47 ,
124+ NullableFloatValue = 0.6f ,
125+ NullableDecimalValue = 4.4m ,
126+ NullableDoubleValue1 = 5.3 ,
127+ NullableDoubleValue2 = 6.3
128+ } ;
68129
69- using ( var session = Domain . OpenSession ( ) )
70- using ( var tx = session . OpenTransaction ( ) ) {
71- _ = new TestEntity ( ) {
72- ByteValue = 2 ,
73- SByteValue = 4 ,
74- ShortValue = 8 ,
75- UShortValue = 9 ,
76- IntValue = 10 ,
77- UIntValue = 11 ,
78- LongValue = 20 ,
79- ULongValue = 25 ,
80- FloatValue = 0.1f ,
81- DecimalValue = 1.2m ,
82- DoubleValue1 = 2.0 ,
83- DoubleValue2 = 3.0 ,
84- NullableByteValue = 2 ,
85- NullableSByteValue = 4 ,
86- NullableShortValue = 8 ,
87- NullableUShortValue = 9 ,
88- NullableIntValue = 30 ,
89- NullableUIntValue = 31 ,
90- NullableLongValue = 40 ,
91- NullableULongValue = 45 ,
92- NullableFloatValue = 0.4f ,
93- NullableDecimalValue = 4.2m ,
94- NullableDoubleValue1 = 5.0 ,
95- NullableDoubleValue2 = 6.0
96- } ;
97- _ = new TestEntity ( ) {
98- ByteValue = 3 ,
99- SByteValue = 5 ,
100- ShortValue = 9 ,
101- UShortValue = 10 ,
102- IntValue = 11 ,
103- UIntValue = 12 ,
104- LongValue = 21 ,
105- ULongValue = 26 ,
106- FloatValue = 0.2f ,
107- DecimalValue = 1.3m ,
108- DoubleValue1 = 2.1 ,
109- DoubleValue2 = 3.1 ,
110- NullableByteValue = 3 ,
111- NullableSByteValue = 5 ,
112- NullableShortValue = 9 ,
113- NullableUShortValue = 10 ,
114- NullableIntValue = 31 ,
115- NullableUIntValue = 32 ,
116- NullableLongValue = 41 ,
117- NullableULongValue = 46 ,
118- NullableFloatValue = 0.5f ,
119- NullableDecimalValue = 4.3m ,
120- NullableDoubleValue1 = 5.1 ,
121- NullableDoubleValue2 = 6.1
122- } ;
123- _ = new TestEntity ( ) {
124- ByteValue = 4 ,
125- SByteValue = 6 ,
126- ShortValue = 10 ,
127- UShortValue = 11 ,
128- IntValue = 12 ,
129- UIntValue = 13 ,
130- LongValue = 22 ,
131- ULongValue = 27 ,
132- FloatValue = 0.3f ,
133- DecimalValue = 1.4m ,
134- DoubleValue1 = 2.3 ,
135- DoubleValue2 = 3.3 ,
136- NullableByteValue = 4 ,
137- NullableSByteValue = 6 ,
138- NullableShortValue = 10 ,
139- NullableUShortValue = 11 ,
140- NullableIntValue = 32 ,
141- NullableUIntValue = 33 ,
142- NullableLongValue = 42 ,
143- NullableULongValue = 47 ,
144- NullableFloatValue = 0.6f ,
145- NullableDecimalValue = 4.4m ,
146- NullableDoubleValue1 = 5.3 ,
147- NullableDoubleValue2 = 6.3
148- } ;
149-
150- tx . Complete ( ) ;
151- }
130+ GlobalSession . SaveChanges ( ) ;
152131 }
153132 }
154133}
0 commit comments