1
|
|
#region Copyright
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
#endregion
|
18
|
|
|
19
|
|
using System;
|
20
|
|
using System.Collections;
|
21
|
|
using System.IO;
|
22
|
|
using System.Reflection;
|
23
|
|
using Seasar.Framework.Container;
|
24
|
|
using Seasar.Framework.Container.Factory;
|
25
|
|
using Seasar.Extension.Unit;
|
26
|
|
using MbUnit.Framework;
|
27
|
|
using log4net;
|
28
|
|
using log4net.Config;
|
29
|
|
using log4net.Util;
|
30
|
|
|
31
|
|
namespace Seasar.Dao.Tests.Interceptors
|
32
|
|
{
|
33
|
|
[TestFixture]
|
34
|
|
public class S2DaoInterceptor2Test : S2TestCase
|
35
|
|
{
|
36
|
|
private IEmployeeAutoDao _dao = null;
|
37
|
|
private ILog _log= LogManager.GetLogger(typeof(S2DaoInterceptor2Test));
|
38
|
|
|
39
|
1
|
public S2DaoInterceptor2Test()
|
40
|
|
{
|
41
|
1
|
FileInfo info = new FileInfo(SystemInfo.AssemblyShortName(
|
42
|
|
Assembly.GetExecutingAssembly()) + ".dll.config");
|
43
|
1
|
XmlConfigurator.Configure(LogManager.GetRepository(), info);
|
44
|
|
}
|
45
|
|
|
46
|
1
|
[Test, S2(Tx.Rollback)]
|
47
|
|
public void TestInsert()
|
48
|
|
{
|
49
|
1
|
Employee emp = new Employee();
|
50
|
1
|
emp.Empno = 99;
|
51
|
1
|
emp.Ename = "hoge";
|
52
|
1
|
Assert.AreEqual(1, _dao.Insert(emp));
|
53
|
|
}
|
54
|
|
|
55
|
1
|
[Test, S2()]
|
56
|
|
public void TestSelect()
|
57
|
|
{
|
58
|
1
|
Employee emp = _dao.GetEmployee(7788);
|
59
|
1
|
_log.Debug(emp);
|
60
|
1
|
Assert.AreEqual(7788, emp.Empno);
|
61
|
|
}
|
62
|
|
|
63
|
1
|
[Test,S2]
|
64
|
|
public void TestSelectQuery()
|
65
|
|
{
|
66
|
1
|
IList employees = _dao.GetEmployeesBySal(0, 1000);
|
67
|
1
|
_log.Debug(employees);
|
68
|
1
|
Assert.AreEqual( 2, employees.Count);
|
69
|
|
}
|
70
|
|
|
71
|
1
|
[Test, S2(Tx.Rollback)]
|
72
|
|
public void TestFullWidthTilda()
|
73
|
|
{
|
74
|
1
|
Employee emp = new Employee();
|
75
|
1
|
emp.Empno = 99;
|
76
|
1
|
emp.Ename = "~";
|
77
|
1
|
_dao.Insert(emp);
|
78
|
1
|
Employee emp2 = _dao.GetEmployee(99);
|
79
|
1
|
Assert.AreEqual(emp.Ename, emp2.Ename);
|
80
|
|
}
|
81
|
|
}
|
82
|
|
}
|
83
|
|
|