1
|
|
#region Copyright
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
#endregion
|
18
|
|
|
19
|
|
using System.Data;
|
20
|
|
using MbUnit.Framework;
|
21
|
|
using Seasar.Extension.DataSets.Impl;
|
22
|
|
using Seasar.Extension.Unit;
|
23
|
|
using Seasar.Framework.Util;
|
24
|
|
|
25
|
|
namespace Seasar.Tests.Extension.DataSets.Impl
|
26
|
|
{
|
27
|
|
[TestFixture]
|
28
|
|
public class SqlTableReaderTest : S2TestCase
|
29
|
|
{
|
30
|
|
private const string PATH = "Ado.dicon";
|
31
|
|
|
32
|
1
|
public void SetUpRead()
|
33
|
|
{
|
34
|
1
|
Include(PATH);
|
35
|
|
}
|
36
|
|
|
37
|
1
|
[Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
|
38
|
|
public void Read()
|
39
|
|
{
|
40
|
1
|
SqlTableReader reader = new SqlTableReader(DataSource);
|
41
|
1
|
reader.SetTable("emp");
|
42
|
1
|
DataTable ret = reader.Read();
|
43
|
1
|
DataTableInspector.OutWriteLine(ret);
|
44
|
1
|
Assert.AreEqual(14, ret.Rows.Count, "1");
|
45
|
1
|
Assert.AreEqual(DataRowState.Unchanged, ret.Rows[0].RowState, "2");
|
46
|
|
}
|
47
|
|
|
48
|
1
|
public void SetUpRead2()
|
49
|
|
{
|
50
|
1
|
Include(PATH);
|
51
|
|
}
|
52
|
|
|
53
|
1
|
[Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
|
54
|
|
public void Read2()
|
55
|
|
{
|
56
|
1
|
SqlTableReader reader = new SqlTableReader(DataSource);
|
57
|
1
|
reader.SetTable("emp", "empno = 7788");
|
58
|
1
|
DataTable ret = reader.Read();
|
59
|
1
|
DataTableInspector.OutWriteLine(ret);
|
60
|
1
|
Assert.AreEqual(1, ret.Rows.Count, "1");
|
61
|
|
}
|
62
|
|
|
63
|
1
|
public void SetUpRead3()
|
64
|
|
{
|
65
|
1
|
Include(PATH);
|
66
|
|
}
|
67
|
|
|
68
|
1
|
[Test, S2(Seasar.Extension.Unit.Tx.Rollback)]
|
69
|
|
public void Read3()
|
70
|
|
{
|
71
|
1
|
SqlTableReader reader = new SqlTableReader(DataSource);
|
72
|
1
|
reader.SetSql("select * from emp", "emp");
|
73
|
1
|
DataTable ret = reader.Read();
|
74
|
1
|
DataTableInspector.OutWriteLine(ret);
|
75
|
1
|
Assert.AreEqual(14, ret.Rows.Count, "1");
|
76
|
|
}
|
77
|
|
}
|
78
|
|
}
|
79
|
|
|