Skip to content

Commit 2101c0c

Browse files
David EllingsworthDavid Ellingsworth
authored andcommitted
GH-3530: Break up the tests by type so we can see which types fail where.
1 parent 78df014 commit 2101c0c

File tree

1 file changed

+88
-8
lines changed
  • src/NHibernate.Test/NHSpecificTest/GH3530

1 file changed

+88
-8
lines changed

src/NHibernate.Test/NHSpecificTest/GH3530/Fixture.cs

Lines changed: 88 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,10 @@ private string GetQualifiedName(string catalog, string schema, string name)
106106
return Dialect.Qualify(catalog, schema, name);
107107
}
108108

109-
[TestCaseSource(nameof(GetTestCases))]
110-
public void TestLocales(CultureInfo from, CultureInfo to)
109+
[Test, TestCaseSource(nameof(GetTestCases))]
110+
public void TestDateTime(CultureInfo from, CultureInfo to)
111111
{
112112
DateTime leapDay = new DateTime(2024, 2, 29, new GregorianCalendar(GregorianCalendarTypes.USEnglish));
113-
double doubleValue = 12.3f;
114-
int intValue = 4;
115113
object id;
116114

117115
CurrentCulture = from;
@@ -120,9 +118,7 @@ public void TestLocales(CultureInfo from, CultureInfo to)
120118
{
121119
var entity = new LocaleEntity()
122120
{
123-
DateTimeValue = leapDay,
124-
DoubleValue = doubleValue,
125-
IntegerValue = intValue,
121+
DateTimeValue = leapDay
126122
};
127123

128124
id = session.Save(entity);
@@ -136,11 +132,95 @@ public void TestLocales(CultureInfo from, CultureInfo to)
136132
var entity = session.Get<LocaleEntity>(id);
137133

138134
Assert.AreEqual(leapDay, entity.DateTimeValue);
139-
Assert.AreEqual(intValue, entity.IntegerValue);
135+
}
136+
}
137+
138+
[Test, TestCaseSource(nameof(GetTestCases))]
139+
public void TestDecimal(CultureInfo from, CultureInfo to)
140+
{
141+
decimal decimalValue = 12.3m;
142+
object id;
143+
144+
CurrentCulture = from;
145+
using (var session = OpenSession())
146+
using (var tx = session.BeginTransaction())
147+
{
148+
var entity = new LocaleEntity()
149+
{
150+
DecimalValue = decimalValue
151+
};
152+
153+
id = session.Save(entity);
154+
tx.Commit();
155+
}
156+
157+
CurrentCulture = to;
158+
using (var session = OpenSession())
159+
using (var tx = session.BeginTransaction())
160+
{
161+
var entity = session.Get<LocaleEntity>(id);
162+
163+
Assert.AreEqual(decimalValue, entity.DecimalValue);
164+
}
165+
}
166+
167+
[Test, TestCaseSource(nameof(GetTestCases))]
168+
public void TestDouble(CultureInfo from, CultureInfo to)
169+
{
170+
double doubleValue = 12.3d;
171+
object id;
172+
173+
CurrentCulture = from;
174+
using (var session = OpenSession())
175+
using (var tx = session.BeginTransaction())
176+
{
177+
var entity = new LocaleEntity()
178+
{
179+
DoubleValue = doubleValue
180+
};
181+
182+
id = session.Save(entity);
183+
tx.Commit();
184+
}
185+
186+
CurrentCulture = to;
187+
using (var session = OpenSession())
188+
using (var tx = session.BeginTransaction())
189+
{
190+
var entity = session.Get<LocaleEntity>(id);
191+
140192
Assert.True(doubleValue - entity.DoubleValue < double.Epsilon);
141193
}
142194
}
143195

196+
public void TestInteger(CultureInfo from, CultureInfo to)
197+
{
198+
int integerValue = 123;
199+
object id;
200+
201+
CurrentCulture = from;
202+
using (var session = OpenSession())
203+
using (var tx = session.BeginTransaction())
204+
{
205+
var entity = new LocaleEntity()
206+
{
207+
IntegerValue = integerValue
208+
};
209+
210+
id = session.Save(entity);
211+
tx.Commit();
212+
}
213+
214+
CurrentCulture = to;
215+
using (var session = OpenSession())
216+
using (var tx = session.BeginTransaction())
217+
{
218+
var entity = session.Get<LocaleEntity>(id);
219+
220+
Assert.AreEqual(integerValue, entity.IntegerValue);
221+
}
222+
}
223+
144224
private CultureInfo CurrentCulture
145225
{
146226
get

0 commit comments

Comments
 (0)