Spring.Data: fix test to work in NET5 (#207)
Co-authored-by: Roberto Paterlini <r.paterlini@almaviva.it>
This commit is contained in:
committed by
GitHub
parent
974247bd0f
commit
9d7325bd67
@@ -74,5 +74,6 @@
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="xcopy "$(ProjectDir)Data" "$(OutDir)" /y /s /q /d" />
|
||||
<Exec Command="copy "$(ProjectDir)App.config" "$(OutDir)testhost.dll.config"" />
|
||||
<Exec Command="copy "$(ProjectDir)App.config" "$(OutDir)ReSharperTestRunner64.dll.config"" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -141,6 +141,12 @@ namespace Spring.Data
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
protected override void OnSetUp()
|
||||
{
|
||||
TestObjectDao.Cleanup();
|
||||
base.OnSetUp();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ namespace Spring.Data
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if NETCOREAPP
|
||||
[Ignore("Not supported on .NET Core")]
|
||||
#endif
|
||||
public void DeclarativeWithAttributes()
|
||||
{
|
||||
IAccountManager mgr = ctx["accountManager"] as IAccountManager;
|
||||
|
||||
@@ -44,6 +44,9 @@ namespace Spring.Data
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if NETCOREAPP
|
||||
[Ignore("Not supported on .NET Core")]
|
||||
#endif
|
||||
public void DeclarativeWithAttributes()
|
||||
{
|
||||
SimpleAccountManager mgr = ctx["accountManager"] as SimpleAccountManager;
|
||||
|
||||
@@ -19,5 +19,6 @@ namespace Spring.Data
|
||||
//
|
||||
int GetCountByAltMethod(int lowerAgeLimit);
|
||||
int GetCountByCommandSetter(int lowerAgeLimit);
|
||||
void Cleanup();
|
||||
}
|
||||
}
|
||||
@@ -201,5 +201,10 @@ namespace Spring.Data
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,5 +145,10 @@ namespace Spring.Data
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
AdoTemplate.ExecuteNonQuery(CommandType.Text, "delete from TestObjects ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,16 @@
|
||||
xmlns:tx="http://www.springframework.net/tx"
|
||||
xmlns:aop="http://www.springframework.net/aop">
|
||||
|
||||
<object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core">
|
||||
<property name="VariableSources">
|
||||
<list>
|
||||
<object type="Spring.ProviderNameSource, Spring.Data.Integration.Tests" />
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
provider="${providerName}"
|
||||
connectionString="Data Source=SPRINGQA;Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa"/>
|
||||
|
||||
|
||||
|
||||
@@ -3,9 +3,16 @@
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
|
||||
<object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core">
|
||||
<property name="VariableSources">
|
||||
<list>
|
||||
<object type="Spring.ProviderNameSource, Spring.Data.Integration.Tests" />
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
provider="${providerName}"
|
||||
connectionString="Data Source=SPRINGQA;Database=Spring;Trusted_Connection=False;User ID=springqa;Password=springqa"/>
|
||||
|
||||
<object id="adoTemplate" type="Spring.Data.Core.AdoTemplate, Spring.Data">
|
||||
|
||||
@@ -2,8 +2,16 @@
|
||||
<objects xmlns='http://www.springframework.net'
|
||||
xmlns:db="http://www.springframework.net/database">
|
||||
|
||||
<object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core">
|
||||
<property name="VariableSources">
|
||||
<list>
|
||||
<object type="Spring.ProviderNameSource, Spring.Data.Integration.Tests" />
|
||||
</list>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
<db:provider id="DbProvider"
|
||||
provider="SqlServer-2.0"
|
||||
provider="${providerName}"
|
||||
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
|
||||
|
||||
<object id="adoTemplate" type="Spring.Data.Core.AdoTemplate, Spring.Data">
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#region License
|
||||
|
||||
// /*
|
||||
// * Copyright 2018 the original author or authors.
|
||||
// *
|
||||
// * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// * you may not use this file except in compliance with the License.
|
||||
// * You may obtain a copy of the License at
|
||||
// *
|
||||
// * http://www.apache.org/licenses/LICENSE-2.0
|
||||
// *
|
||||
// * Unless required by applicable law or agreed to in writing, software
|
||||
// * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// * See the License for the specific language governing permissions and
|
||||
// * limitations under the License.
|
||||
// */
|
||||
|
||||
#endregion
|
||||
|
||||
#region using
|
||||
|
||||
using Spring.Objects.Factory.Config;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Spring
|
||||
{
|
||||
public class ProviderNameSource : IVariableSource
|
||||
{
|
||||
public bool CanResolveVariable(string name)
|
||||
{
|
||||
return name.ToLower() == "providername";
|
||||
}
|
||||
|
||||
public string ResolveVariable(string name)
|
||||
{
|
||||
if (name.ToLower() != "providername")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
#if NETCOREAPP
|
||||
return "SqlServer";
|
||||
#else
|
||||
return "SqlServer-2.0";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user