Skip to content

Commit 9d7325b

Browse files
rpaterliniRoberto Paterlini
andauthored
Spring.Data: fix test to work in NET5 (#207)
Co-authored-by: Roberto Paterlini <r.paterlini@almaviva.it>
1 parent 974247b commit 9d7325b

File tree

11 files changed

+100
-5
lines changed

11 files changed

+100
-5
lines changed

test/Spring/Spring.Core.Tests/Spring.Core.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@
7474
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
7575
<Exec Command="xcopy &quot;$(ProjectDir)Data&quot; &quot;$(OutDir)&quot; /y /s /q /d" />
7676
<Exec Command="copy &quot;$(ProjectDir)App.config&quot; &quot;$(OutDir)testhost.dll.config&quot;" />
77+
<Exec Command="copy &quot;$(ProjectDir)App.config&quot; &quot;$(OutDir)ReSharperTestRunner64.dll.config&quot;" />
7778
</Target>
7879
</Project>

test/Spring/Spring.Data.Integration.Tests/Data/AdoDaoTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ protected override string[] ConfigLocations
141141
}
142142
}
143143

144-
#endregion
144+
protected override void OnSetUp()
145+
{
146+
TestObjectDao.Cleanup();
147+
base.OnSetUp();
148+
}
149+
150+
#endregion
145151
}
146152
}

test/Spring/Spring.Data.Integration.Tests/Data/DTCTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public void SetUp()
5050
}
5151

5252
[Test]
53+
#if NETCOREAPP
54+
[Ignore("Not supported on .NET Core")]
55+
#endif
5356
public void DeclarativeWithAttributes()
5457
{
5558
IAccountManager mgr = ctx["accountManager"] as IAccountManager;

test/Spring/Spring.Data.Integration.Tests/Data/DTCTestsNoInterfaces.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public void SetUp()
4444
}
4545

4646
[Test]
47+
#if NETCOREAPP
48+
[Ignore("Not supported on .NET Core")]
49+
#endif
4750
public void DeclarativeWithAttributes()
4851
{
4952
SimpleAccountManager mgr = ctx["accountManager"] as SimpleAccountManager;

test/Spring/Spring.Data.Integration.Tests/Data/ITestObjectDao.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ public interface ITestObjectDao
1919
//
2020
int GetCountByAltMethod(int lowerAgeLimit);
2121
int GetCountByCommandSetter(int lowerAgeLimit);
22+
void Cleanup();
2223
}
2324
}

test/Spring/Spring.Data.Integration.Tests/Data/NativeAdoTestObjectDao.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,10 @@ public int GetCountByCommandSetter(int lowerAgeLimit)
201201
{
202202
throw new NotImplementedException();
203203
}
204+
205+
public void Cleanup()
206+
{
207+
throw new NotImplementedException();
208+
}
204209
}
205210
}

test/Spring/Spring.Data.Integration.Tests/Data/TestObjectDao.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,10 @@ public object MapRow(IDataReader dataReader, int rowNum)
145145
#endregion
146146

147147
}
148-
}
148+
149+
public void Cleanup()
150+
{
151+
AdoTemplate.ExecuteNonQuery(CommandType.Text, "delete from TestObjects ");
152+
}
153+
}
149154
}

test/Spring/Spring.Data.Integration.Tests/Data/TestTxIsolationLevel.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
xmlns:tx="http://www.springframework.net/tx"
55
xmlns:aop="http://www.springframework.net/aop">
66

7+
<object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core">
8+
<property name="VariableSources">
9+
<list>
10+
<object type="Spring.ProviderNameSource, Spring.Data.Integration.Tests" />
11+
</list>
12+
</property>
13+
</object>
714

815
<db:provider id="DbProvider"
9-
provider="SqlServer-2.0"
16+
provider="${providerName}"
1017
connectionString="Data Source=SPRINGQA;Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa"/>
1118

1219

test/Spring/Spring.Data.Integration.Tests/Data/adoTemplateTests.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
xmlns:db="http://www.springframework.net/database">
44

55

6+
<object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core">
7+
<property name="VariableSources">
8+
<list>
9+
<object type="Spring.ProviderNameSource, Spring.Data.Integration.Tests" />
10+
</list>
11+
</property>
12+
</object>
613

714
<db:provider id="DbProvider"
8-
provider="SqlServer-2.0"
15+
provider="${providerName}"
916
connectionString="Data Source=SPRINGQA;Database=Spring;Trusted_Connection=False;User ID=springqa;Password=springqa"/>
1017

1118
<object id="adoTemplate" type="Spring.Data.Core.AdoTemplate, Spring.Data">

test/Spring/Spring.Data.Integration.Tests/Data/declarativeServices.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
<objects xmlns='http://www.springframework.net'
33
xmlns:db="http://www.springframework.net/database">
44

5+
<object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core">
6+
<property name="VariableSources">
7+
<list>
8+
<object type="Spring.ProviderNameSource, Spring.Data.Integration.Tests" />
9+
</list>
10+
</property>
11+
</object>
12+
513
<db:provider id="DbProvider"
6-
provider="SqlServer-2.0"
14+
provider="${providerName}"
715
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
816

917
<object id="adoTemplate" type="Spring.Data.Core.AdoTemplate, Spring.Data">

0 commit comments

Comments
 (0)