SPRNET-1273 - Remove unnecessary cast to (int) in Spring.Data.Core.AdoTemplate ExecuteScalar with ICommandSetter
This commit is contained in:
@@ -532,7 +532,7 @@ namespace Spring.Data.Core
|
||||
}
|
||||
#endregion
|
||||
|
||||
return (int)Execute(new ExecuteScalarCallbackWithCommandSetter(cmdType, cmdText, commandSetter));
|
||||
return Execute(new ExecuteScalarCallbackWithCommandSetter(cmdType, cmdText, commandSetter));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,19 +4,59 @@ using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Dao;
|
||||
using Spring.Objects;
|
||||
using Spring.Testing.NUnit;
|
||||
|
||||
namespace Spring.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for AdoTemplateTests.
|
||||
/// Test AdoTemplate based DAO object.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class AdoDaoTests
|
||||
public class AdoDaoTests : AbstractTransactionalSpringContextTests
|
||||
{
|
||||
public AdoDaoTests()
|
||||
{
|
||||
}
|
||||
|
||||
private TestObjectDao dao;
|
||||
|
||||
public TestObjectDao TestObjectDao
|
||||
{
|
||||
get { return dao; }
|
||||
set { dao = value; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExerciseDao()
|
||||
{
|
||||
Assert.AreEqual(0, dao.GetCount());
|
||||
dao.Create("John", 44);
|
||||
Assert.AreEqual(1, dao.GetCountByDelegate());
|
||||
dao.Create("Mary", 44);
|
||||
dao.Create("Steve", 44);
|
||||
dao.Create("George", 33);
|
||||
Assert.AreEqual(4, dao.GetCount(), "GetCount()");
|
||||
Assert.AreEqual(3, dao.GetCount(33), "GetCount(33)");
|
||||
Assert.AreEqual(3, dao.GetCountByAltMethod(33), "GetCountByAltMethod(33)");
|
||||
Assert.AreEqual(3, dao.GetCountByCommandSetter(33), "GetCountByCommandSetter(33)");
|
||||
Assert.AreEqual(1, dao.GetCount(32, "George"), "GetCount(32, 'George')");
|
||||
|
||||
TestObject to = dao.FindByName("George");
|
||||
Assert.IsNotNull(to);
|
||||
Assert.AreEqual("George", to.Name);
|
||||
Assert.AreEqual(33, to.Age);
|
||||
|
||||
to.Age = 34;
|
||||
dao.Update(to);
|
||||
|
||||
TestObject to2 = dao.FindByName("George");
|
||||
Assert.AreEqual(34, to2.Age);
|
||||
|
||||
dao.Delete("George");
|
||||
|
||||
TestObject to3 = dao.FindByName("George");
|
||||
Assert.IsNull(to3);
|
||||
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void SimpleCreate()
|
||||
{
|
||||
@@ -27,6 +67,8 @@ namespace Spring.Data
|
||||
Assert.IsNotNull(dao);
|
||||
dao.Create("John", 44);
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void SimpleDao()
|
||||
{
|
||||
@@ -45,6 +87,7 @@ namespace Spring.Data
|
||||
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void SimpleDao2()
|
||||
{
|
||||
@@ -56,6 +99,7 @@ namespace Spring.Data
|
||||
Assert.AreEqual(1, dao.GetCountByDelegate());
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void DaoOperations()
|
||||
{
|
||||
@@ -83,5 +127,22 @@ namespace Spring.Data
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region Overrides of AbstractDependencyInjectionSpringContextTests
|
||||
|
||||
/// <summary>
|
||||
/// Subclasses must implement this property to return the locations of their
|
||||
/// config files. A plain path will be treated as a file system location.
|
||||
/// </summary>
|
||||
/// <value>An array of config locations</value>
|
||||
protected override string[] ConfigLocations
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[] { "assembly://Spring.Data.Integration.Tests/Spring.Data/templateTests.xml" };
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<d:provider id="DbProvider"
|
||||
provider="System.Data.SqlClient"
|
||||
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa; Password=springqa"/>
|
||||
connectionString="Data Source=SPRINGQA;Initial Catalog=Spring;User ID=springqa; Password=springqa"/>
|
||||
|
||||
<object name="LoggingAdvice" type="Spring.Aspects.Logging.SimpleLoggingAdvice, Spring.Aop">
|
||||
<property name="logUniqueIdentifier" value="true"/>
|
||||
@@ -43,7 +43,7 @@
|
||||
</object>
|
||||
|
||||
|
||||
<object id="adoTransactionManager"
|
||||
<object id="transactionManager"
|
||||
type="Spring.Data.Core.AdoPlatformTransactionManager, Spring.Data">
|
||||
|
||||
<property name="DbProvider" ref="DbProvider"/>
|
||||
@@ -79,7 +79,7 @@
|
||||
<object id="testObjectManagerTP"
|
||||
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
|
||||
|
||||
<property name="PlatformTransactionManager" ref="adoTransactionManager"/>
|
||||
<property name="PlatformTransactionManager" ref="transactionManager"/>
|
||||
<property name="Target">
|
||||
<object type="Spring.Data.TestObjectManager, Spring.Data.Integration.Tests">
|
||||
<property name="TestObjectDao" ref="testObjectDao"/>
|
||||
@@ -110,7 +110,7 @@
|
||||
<!-- Transaction Interceptor -->
|
||||
<object id="transactionInterceptor"
|
||||
type="Spring.Transaction.Interceptor.TransactionInterceptor, Spring.Data">
|
||||
<property name="TransactionManager" ref="adoTransactionManager"/>
|
||||
<property name="TransactionManager" ref="transactionManager"/>
|
||||
<!-- note do not have converter from string to this property type registered -->
|
||||
<property name="TransactionAttributeSource" ref="methodMapTransactionAttributeSource"/>
|
||||
</object>
|
||||
|
||||
@@ -109,6 +109,10 @@
|
||||
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
|
||||
<Name>Spring.Data.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Testing.NUnit\Spring.Testing.NUnit.2008.csproj">
|
||||
<Project>{ED204A7B-832F-44C7-BFE3-504AEBE1BCC8}</Project>
|
||||
<Name>Spring.Testing.NUnit.2008</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.Core.Tests\Spring.Core.Tests.2008.csproj">
|
||||
<Project>{44B16BAA-6DF8-447C-9D7F-3AD3D854D904}</Project>
|
||||
<Name>Spring.Core.Tests.2008</Name>
|
||||
|
||||
Reference in New Issue
Block a user