Skip to content

Commit 8e15947

Browse files
committed
NH-3807 - Disable more .net tests in .NET Core because of serialization.
1 parent ea58b47 commit 8e15947

File tree

12 files changed

+100
-24
lines changed

12 files changed

+100
-24
lines changed

src/NHibernate.Test/ConnectionTest/AggressiveReleaseTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ protected override void Done()
4343

4444
// Some additional tests specifically for the aggressive-Release functionality...
4545

46+
#if !NETCOREAPP2_0
4647
[Test]
4748
public void SerializationOnAfterStatementAggressiveRelease()
4849
{
@@ -103,6 +104,7 @@ public void SerializationFailsOnAfterStatementAggressiveReleaseWithOpenResources
103104
Release(s);
104105
Done();
105106
}
107+
#endif
106108

107109
[Test]
108110
public void QueryIteration()
@@ -246,4 +248,4 @@ public void ConnectionMaintanenceDuringFlush()
246248
Done();
247249
}
248250
}
249-
}
251+
}

src/NHibernate.Test/Criteria/CriteriaQueryTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ public void CloningCriteria_AddCount_RemoveOrdering()
461461
s.Close();
462462
}
463463

464+
#if !NETCOREAPP2_0
464465
[Test]
465466
public void DetachedCriteriaTest()
466467
{
@@ -498,6 +499,7 @@ public void DetachedCriteriaTest()
498499
t.Commit();
499500
session.Close();
500501
}
502+
#endif
501503

502504
[Test]
503505
public void SubqueryPaginationOnlyWithFirst()
@@ -3051,4 +3053,4 @@ public void CanSetLockModeOnDetachedCriteria()
30513053
}
30523054
}
30533055
}
3054-
}
3056+
}

src/NHibernate.Test/Criteria/DetachedCriteriaSerializable.cs

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ public void AllEmbeddedResultTransformersAreSerializable()
5151
NHAssert.InheritedAreMarkedSerializable(typeof(IResultTransformer));
5252
}
5353

54+
#if !NETCOREAPP2_0
5455
[Test]
5556
public void DetachedCriteriaItSelf()
5657
{
5758
DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
5859
.Add(Expression.Eq("Name", "Gavin King"));
5960
SerializeAndList(dc);
6061
}
62+
#endif
6163

6264
[Test]
6365
public void BasicCriterions()
@@ -167,6 +169,7 @@ public void ProjectionsExpressions()
167169
NHAssert.IsSerializable(p);
168170
}
169171

172+
#if !NETCOREAPP2_0
170173
[Test]
171174
public void Junctions()
172175
{
@@ -258,6 +261,7 @@ public void SubqueriesExpressions()
258261
c = Subqueries.PropertyNotIn("Name", dc);
259262
NHAssert.IsSerializable(c);
260263
}
264+
#endif
261265

262266
[Test]
263267
public void SQLCriterion()
@@ -280,6 +284,7 @@ public void SQLProjection()
280284
NHAssert.IsSerializable(p);
281285
}
282286

287+
#if !NETCOREAPP2_0
283288
[Test]
284289
public void ResultTransformes()
285290
{
@@ -300,7 +305,7 @@ public void ResultTransformes()
300305
}
301306

302307
[Test]
303-
public void ExecutableCriteria()
308+
public void ExecutableCriteria1()
304309
{
305310
// All query below don't have sense, are only to test if all needed classes are serializable
306311

@@ -330,89 +335,132 @@ public void ExecutableCriteria()
330335
.SetProjection(Property.ForName("StudentNumber"));
331336

332337
SerializeAndList(dc);
338+
}
333339

340+
[Test]
341+
public void ExecutableCriteria2()
342+
{
334343
// Like match modes
335-
dc = DetachedCriteria.For(typeof(Student))
344+
DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
336345
.Add(Expression.Like("Name", "Gavin", MatchMode.Anywhere))
337346
.Add(Expression.Like("Name", "Gavin", MatchMode.End))
338347
.Add(Expression.Like("Name", "Gavin", MatchMode.Exact))
339348
.Add(Expression.Like("Name", "Gavin", MatchMode.Start));
340349

341350
SerializeAndList(dc);
351+
}
342352

353+
[Test]
354+
public void ExecutableCriteria3()
355+
{
343356
// Logical Expression
344-
dc = DetachedCriteria.For(typeof(Student))
357+
DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
345358
.Add(Expression.Or(Expression.Eq("Name", "Ralph"), Expression.Eq("Name", "Gavin")))
346359
.Add(
347360
Expression.And(Expression.Gt("StudentNumber", 1L),
348361
Expression.Lt("StudentNumber", 10L)));
349362

350363
SerializeAndList(dc);
364+
}
351365

366+
[Test]
367+
public void ExecutableCriteria4()
368+
{
352369
// Projections
353-
dc = DetachedCriteria.For(typeof(Enrolment))
370+
DetachedCriteria dc = DetachedCriteria.For(typeof(Enrolment))
354371
.SetProjection(Projections.Distinct(Projections.ProjectionList()
355372
.Add(Projections.Property("StudentNumber"), "stNumber")
356373
.Add(Projections.Property("CourseCode"), "cCode")))
357374
.Add(Expression.Lt("StudentNumber", 668L));
358375
SerializeAndList(dc);
376+
}
359377

360-
if (TestDialect.SupportsCountDistinct)
361-
{
362-
dc = DetachedCriteria.For(typeof(Enrolment))
363-
.SetProjection(Projections.Count("StudentNumber").SetDistinct());
364-
SerializeAndList(dc);
365-
}
378+
[Test]
379+
public void ExecutableCriteria5()
380+
{
381+
if (TestDialect.SupportsCountDistinct) Assert.Ignore("Dialect doesn't support CountDistinct");
366382

367-
dc = DetachedCriteria.For(typeof(Enrolment))
383+
DetachedCriteria dc = DetachedCriteria.For(typeof(Enrolment))
384+
.SetProjection(Projections.Count("StudentNumber").SetDistinct());
385+
SerializeAndList(dc);
386+
}
387+
388+
[Test]
389+
public void ExecutableCriteria6()
390+
{
391+
DetachedCriteria dc = DetachedCriteria.For(typeof(Enrolment))
368392
.SetProjection(Projections.ProjectionList()
369393
.Add(Projections.Count("StudentNumber"))
370394
.Add(Projections.Max("StudentNumber"))
371395
.Add(Projections.Min("StudentNumber"))
372396
.Add(Projections.Avg("StudentNumber")));
373397
SerializeAndList(dc);
398+
}
374399

400+
[Test]
401+
public void ExecutableCriteria7()
402+
{
375403
// Junctions
376-
dc = DetachedCriteria.For(typeof(Student))
404+
DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
377405
.Add(Expression.Conjunction()
378406
.Add(Expression.Eq("Name", "Ralph"))
379407
.Add(Expression.Eq("StudentNumber", 1L)))
380408
.Add(Expression.Disjunction()
381409
.Add(Expression.Eq("Name", "Ralph"))
382410
.Add(Expression.Eq("Name", "Gavin")));
383411
SerializeAndList(dc);
412+
}
384413

414+
[Test]
415+
public void ExecutableCriteria8()
416+
{
385417
// Subquery
386-
dc = DetachedCriteria.For(typeof(Student))
418+
DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
387419
.Add(Property.ForName("StudentNumber").Eq(232L))
388420
.SetProjection(Property.ForName("Name"));
389421

390422
DetachedCriteria dcs = DetachedCriteria.For(typeof(Student))
391423
.Add(Subqueries.PropertyEqAll("Name", dc));
392424
SerializeAndList(dc);
425+
}
393426

427+
[Test]
428+
public void ExecutableCriteria9()
429+
{
394430
// SQLCriterion
395-
dc = DetachedCriteria.For(typeof(Student))
431+
DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
396432
.Add(Expression.Sql("{alias}.Name = 'Gavin'"));
397433
SerializeAndList(dc);
434+
}
398435

436+
[Test]
437+
public void ExecutableCriteria10()
438+
{
399439
// SQLProjection
400-
dc = DetachedCriteria.For(typeof(Enrolment))
440+
DetachedCriteria dc = DetachedCriteria.For(typeof(Enrolment))
401441
.SetProjection(Projections.SqlProjection("1 as constOne, count(*) as countStar",
402442
new String[] { "constOne", "countStar" },
403443
new IType[] { NHibernateUtil.Int32, NHibernateUtil.Int32 }));
404444
SerializeAndList(dc);
445+
}
405446

406-
dc = DetachedCriteria.For(typeof(Student))
447+
[Test]
448+
public void ExecutableCriteria11()
449+
{
450+
DetachedCriteria dc = DetachedCriteria.For(typeof(Student))
407451
.SetProjection(
408452
Projections.SqlGroupProjection("COUNT({alias}.studentId), {alias}.preferredCourseCode",
409453
"{alias}.preferredCourseCode",
410454
new string[] { "studentsOfCourse", "CourseCode" },
411455
new IType[] { NHibernateUtil.Int32, NHibernateUtil.Int32 }));
412456
SerializeAndList(dc);
457+
}
413458

459+
[Test]
460+
public void ExecutableCriteria12()
461+
{
414462
// Result transformers
415-
dc = DetachedCriteria.For(typeof(Enrolment))
463+
DetachedCriteria dc = DetachedCriteria.For(typeof(Enrolment))
416464
.CreateAlias("Student", "st")
417465
.CreateAlias("Course", "co")
418466
.SetProjection(Projections.ProjectionList()
@@ -423,5 +471,6 @@ public void ExecutableCriteria()
423471
.SetResultTransformer(Transformers.AliasToBean(typeof(StudentDTO)));
424472
SerializeAndList(dc);
425473
}
474+
#endif
426475
}
427-
}
476+
}

src/NHibernate.Test/DynamicProxyTests/InterfaceProxySerializationTests/ProxyFixture.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public void Proxy()
9292
s.Close();
9393
}
9494

95+
#if !NETCOREAPP2_0
9596
[Test]
9697
public void ProxySerialize()
9798
{
@@ -138,5 +139,6 @@ public void SerializeNotFoundProxy()
138139
Assert.IsNotNull(s.Load(typeof (MyProxyImpl), 5), "should be proxy - even though it doesn't exists in db");
139140
s.Close();
140141
}
142+
#endif
141143
}
142144
}

src/NHibernate.Test/DynamicProxyTests/LazyFieldInterceptorTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public void LazyFieldInterceptorMarkedAsSerializable()
2626
Assert.That(typeof(DefaultDynamicLazyFieldInterceptor), Has.Attribute<SerializableAttribute>());
2727
}
2828

29+
#if !NETCOREAPP2_0
2930
[Test]
3031
public void LazyFieldInterceptorIsBinarySerializable()
3132
{
@@ -37,6 +38,7 @@ public void LazyFieldInterceptorIsBinarySerializable()
3738

3839
NHAssert.IsSerializable(fieldInterceptionProxy);
3940
}
41+
#endif
4042

4143

4244
[Test]

src/NHibernate.Test/Legacy/FooBarTest.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2827,6 +2827,7 @@ public void PersistCollections()
28272827
txn.Commit();
28282828
s.Disconnect();
28292829

2830+
#if !NETCOREAPP2_0
28302831
// serialize and then deserialize the session.
28312832
Stream stream = new MemoryStream();
28322833
IFormatter formatter = new BinaryFormatter();
@@ -2837,6 +2838,7 @@ public void PersistCollections()
28372838
stream.Position = 0;
28382839
s = (ISession) formatter.Deserialize(stream);
28392840
stream.Close();
2841+
#endif
28402842

28412843
s.Reconnect();
28422844
txn = s.BeginTransaction();
@@ -2875,6 +2877,7 @@ public void PersistCollections()
28752877
txn.Commit();
28762878
s.Disconnect();
28772879

2880+
#if !NETCOREAPP2_0
28782881
// serialize and then deserialize the session.
28792882
stream = new MemoryStream();
28802883
formatter.Serialize(stream, s);
@@ -2884,6 +2887,7 @@ public void PersistCollections()
28842887
stream.Position = 0;
28852888
s = (ISession) formatter.Deserialize(stream);
28862889
stream.Close();
2890+
#endif
28872891

28882892
Qux nonexistentQux = (Qux) s.Load(typeof(Qux), (long) 666); //nonexistent
28892893
Assert.IsNotNull(nonexistentQux, "even though it doesn't exists should still get a proxy - no db hit.");
@@ -4639,6 +4643,7 @@ public void SaveDelete()
46394643
s.Close();
46404644
}
46414645

4646+
#if !NETCOREAPP2_0
46424647
[Test]
46434648
public void ProxyArray()
46444649
{
@@ -4691,6 +4696,7 @@ public void ProxyArray()
46914696

46924697
s.Close();
46934698
}
4699+
#endif
46944700

46954701
[Test]
46964702
public void Cache()
@@ -5439,7 +5445,7 @@ public void PSCache()
54395445
}
54405446
}
54415447

5442-
#region NHibernate specific tests
5448+
#region NHibernate specific tests
54435449

54445450
[Test]
54455451
public void Formula()
@@ -5546,6 +5552,6 @@ public void ParameterInOrderByClause()
55465552
}
55475553
}
55485554

5549-
#endregion
5555+
#endregion
55505556
}
55515557
}

src/NHibernate.Test/Legacy/MasterDetailTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ public void NamedQuery()
636636
s.Close();
637637
}
638638

639+
#if !NETCOREAPP2_0
639640
[Test]
640641
public void Serialization()
641642
{
@@ -726,6 +727,7 @@ public void Serialization()
726727
}
727728
Assert.IsTrue(false, "serialization should have failed");
728729
}
730+
#endif
729731

730732
[Test]
731733
public void UpdateLazyCollections()

src/NHibernate.Test/NHSpecificTest/NH3119/FixtureByCode.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public void PocoComponentTuplizer_Instantiate_UsesReflectonOptimizer()
7979
}
8080
}
8181

82+
#if !NETCOREAPP2_0
8283
[Test]
8384
public void PocoComponentTuplizerOfDeserializedConfiguration_Instantiate_UsesReflectonOptimizer()
8485
{
@@ -101,5 +102,6 @@ public void PocoComponentTuplizerOfDeserializedConfiguration_Instantiate_UsesRef
101102
StringAssert.Contains("NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateInstance", stackTrace);
102103
}
103104
}
105+
#endif
104106
}
105107
}

src/NHibernate.Test/NHSpecificTest/NH3383/FixtureByCode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public void CanRoundTripSerializedMultipleCascadeStyle()
5959
}
6060

6161

62+
#if !NETCOREAPP2_0
6263
[Test]
6364
public void DeserializedPropertyMapping_RefersToSameCascadeStyle()
6465
{
@@ -77,7 +78,6 @@ public void DeserializedPropertyMapping_RefersToSameCascadeStyle()
7778
AssertDeserializedMappingClasses(deserializedClassMapping);
7879
}
7980

80-
#if !NETCOREAPP2_0
8181
// This test uses a seperate AppDomain to simulate the loading of a Configuration that was
8282
// serialized to the disk and is later deserialized in a new process.
8383
[Test]

0 commit comments

Comments
 (0)