Skip to content

Commit 9cc7350

Browse files
committed
Add NetFxOnlyAttribute
1 parent ac7420e commit 9cc7350

File tree

7 files changed

+76
-18
lines changed

7 files changed

+76
-18
lines changed

src/NHibernate.Test/Ado/BatcherFixture.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,14 @@ public void OneRoundTripUpdate()
9090
Cleanup();
9191
}
9292

93-
#if NETFX
94-
[Test, Ignore("Not fixed yet.")]
93+
[Test, Ignore("Not fixed yet."), NetFxOnly]
9594
[Description("SqlClient: The batcher should run all different INSERT queries in only one roundtrip.")]
9695
public void SqlClientOneRoundTripForUpdateAndInsert()
9796
{
97+
#if NETFX
9898
if (Sfi.Settings.BatcherFactory is SqlClientBatchingBatcherFactory == false)
9999
Assert.Ignore("This test is for SqlClientBatchingBatcher only");
100+
#endif
100101

101102
FillDb();
102103

@@ -129,12 +130,14 @@ public void SqlClientOneRoundTripForUpdateAndInsert()
129130
Cleanup();
130131
}
131132

132-
[Test]
133+
[Test, NetFxOnly]
133134
[Description("SqlClient: The batcher log output should be formatted")]
134135
public void BatchedoutputShouldBeFormatted()
135136
{
137+
#if NETFX
136138
if (Sfi.Settings.BatcherFactory is SqlClientBatchingBatcherFactory == false)
137139
Assert.Ignore("This test is for SqlClientBatchingBatcher only");
140+
#endif
138141

139142
using (var sqlLog = new SqlLogSpy())
140143
{
@@ -145,7 +148,6 @@ public void BatchedoutputShouldBeFormatted()
145148

146149
Cleanup();
147150
}
148-
#endif
149151

150152
[Test]
151153
[Description("The batcher should run all DELETE queries in only one roundtrip.")]

src/NHibernate.Test/Async/Ado/BatcherFixture.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,25 @@ public async Task OneRoundTripUpdateAsync()
102102
await (CleanupAsync());
103103
}
104104

105+
[Test, NetFxOnly]
106+
[Description("SqlClient: The batcher log output should be formatted")]
107+
public async Task BatchedoutputShouldBeFormattedAsync()
108+
{
105109
#if NETFX
110+
if (Sfi.Settings.BatcherFactory is SqlClientBatchingBatcherFactory == false)
111+
Assert.Ignore("This test is for SqlClientBatchingBatcher only");
106112
#endif
107113

114+
using (var sqlLog = new SqlLogSpy())
115+
{
116+
await (FillDbAsync());
117+
var log = sqlLog.GetWholeLog();
118+
Assert.IsTrue(log.Contains("INSERT \n INTO"));
119+
}
120+
121+
await (CleanupAsync());
122+
}
123+
108124
[Test]
109125
[Description("The batcher should run all DELETE queries in only one roundtrip.")]
110126
public async Task OneRoundTripDeleteAsync()

src/NHibernate.Test/Async/Tools/hbm2ddl/SchemaValidator/SchemaValidateFixture.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,34 @@ public async Task ShouldVerifySameTableAsync()
5252
await (validator.ValidateAsync());
5353
}
5454

55-
#if NETFX
56-
#endif
55+
[Test, SetCulture("tr-TR"), SetUICulture("tr-TR"), NetFxOnly]
56+
public async Task ShouldVerifySameTableTurkishAsync()
57+
{
58+
//NH-3063
59+
60+
// Turkish have unusual casing rules for the letter 'i'. This test verifies that
61+
// code paths executed by the SchemaValidator correctly handles case insensitive
62+
// comparisons for this.
63+
64+
// Just make sure that we have an int property in the mapped class. This is
65+
// the 'i' we rely on for the test.
66+
var v = new Version();
67+
Assert.That(v.Id, Is.TypeOf<int>());
68+
69+
var cfg = BuildConfiguration(_version1Resource);
70+
71+
var export = new SchemaExport(cfg);
72+
await (export.CreateAsync(true, true));
73+
try
74+
{
75+
var validator = new Tool.hbm2ddl.SchemaValidator(cfg);
76+
await (validator.ValidateAsync());
77+
}
78+
finally
79+
{
80+
await (export.DropAsync(true, true));
81+
}
82+
}
5783

5884
[Test]
5985
public void ShouldNotVerifyModifiedTableAsync()

src/NHibernate.Test/DriverTest/ReflectionBasedDriverTest.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,19 @@ public override string NamedPrefix
6464
}
6565
}
6666

67-
#if NETFX
68-
[Test]
67+
[Test, NetFxOnly]
6968
public void WhenCreatedWithGoodDbProviderThenNotThrows()
7069
{
7170
Assert.That(() => new MyDriverWithWrongClassesAndGoodDbProviderFactory(), Throws.Nothing);
7271
}
7372

74-
[Test]
73+
[Test, NetFxOnly]
7574
public void WhenCreatedWithNullAssemblyAndGoodDbProviderThenNotThrows()
7675
{
7776
Assert.That(() => new MyDriverWithWrongClassesAndGoodDbProviderFactory(null), Throws.Nothing);
7877
}
7978

80-
[Test]
79+
[Test, NetFxOnly]
8180
public void WhenCreatedWithDbFactoryThenCanReturnConnection()
8281
{
8382
var provider = new MyDriverWithWrongClassesAndGoodDbProviderFactory();
@@ -87,7 +86,7 @@ public void WhenCreatedWithDbFactoryThenCanReturnConnection()
8786
}
8887
}
8988

90-
[Test]
89+
[Test, NetFxOnly]
9190
public void WhenCreatedWithDbFactoryThenCanReturnCommand()
9291
{
9392
var provider = new MyDriverWithWrongClassesAndGoodDbProviderFactory();
@@ -96,7 +95,6 @@ public void WhenCreatedWithDbFactoryThenCanReturnCommand()
9695
Assert.That(command, Is.Not.Null);
9796
}
9897
}
99-
#endif
10098

10199
[Test]
102100
public void WhenCreatedWithNoDbProviderThenNotThrows()
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using NUnit.Framework;
3+
using NUnit.Framework.Interfaces;
4+
5+
namespace NHibernate.Test
6+
{
7+
public class NetFxOnlyAttribute : Attribute, ITestAction
8+
{
9+
public ActionTargets Targets => ActionTargets.Default;
10+
11+
public void AfterTest(ITest test) { }
12+
13+
public void BeforeTest(ITest test)
14+
{
15+
#if !NETFX
16+
Assert.Ignore("This test is only for NETFX.");
17+
#endif
18+
}
19+
}
20+
}

src/NHibernate.Test/Tools/hbm2ddl/SchemaValidator/SchemaValidateFixture.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ public void ShouldVerifySameTable()
4141
validator.Validate();
4242
}
4343

44-
#if NETFX
45-
[Test, SetCulture("tr-TR"), SetUICulture("tr-TR")]
44+
[Test, SetCulture("tr-TR"), SetUICulture("tr-TR"), NetFxOnly]
4645
public void ShouldVerifySameTableTurkish()
4746
{
4847
//NH-3063
@@ -70,7 +69,6 @@ public void ShouldVerifySameTableTurkish()
7069
export.Drop(true, true);
7170
}
7271
}
73-
#endif
7472

7573
[Test]
7674
public void ShouldNotVerifyModifiedTable()

src/NHibernate.Test/UtilityTest/ReflectHelperFixture.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ public void NoTypeFoundReturnsNull()
8282
Assert.IsNull(noType);
8383
}
8484

85-
#if NETFX
86-
[Test]
85+
[Test, NetFxOnly]
8786
public void TypeFoundInNotLoadedAssembly()
8887
{
8988
System.Type httpRequest = ReflectHelper.TypeFromAssembly("System.Web.HttpRequest", "System.Web", false);
@@ -92,7 +91,6 @@ public void TypeFoundInNotLoadedAssembly()
9291
System.Type sameType = ReflectHelper.TypeFromAssembly("System.Web.HttpRequest", "System.Web", false);
9392
Assert.AreEqual(httpRequest, sameType, "should be the exact same Type");
9493
}
95-
#endif
9694

9795
[Test]
9896
public void SystemTypes()

0 commit comments

Comments
 (0)