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 System.IO;
|
21
|
|
using System.Reflection;
|
22
|
|
using MbUnit.Framework;
|
23
|
|
using Seasar.Extension.DataSets;
|
24
|
|
using Seasar.Extension.DataSets.Impl;
|
25
|
|
using Seasar.Extension.Unit;
|
26
|
|
using Seasar.Framework.Util;
|
27
|
|
|
28
|
|
namespace Seasar.Tests.Extension.DataSets.Impl
|
29
|
|
{
|
30
|
|
[TestFixture]
|
31
|
|
public class XlsWriterTest : S2TestCase
|
32
|
|
{
|
33
|
|
private const string PATH = "Seasar.Tests.Extension.DataSets.Impl.XlsReaderImplTest.xls";
|
34
|
|
|
35
|
|
private string path2_;
|
36
|
|
|
37
|
|
private DataSet dataSet_;
|
38
|
|
|
39
|
|
private IDataWriter writer_;
|
40
|
|
|
41
|
1
|
[SetUp]
|
42
|
|
public void SetUp()
|
43
|
|
{
|
44
|
1
|
using (Stream stream = ResourceUtil.GetResourceAsStream(PATH, Assembly.GetExecutingAssembly()))
|
45
|
|
{
|
46
|
1
|
dataSet_ = new XlsReader(stream).Read();
|
47
|
|
}
|
48
|
1
|
path2_ = Path.Combine(Path.GetTempPath(), "XlsWriterImplTest.xls");
|
49
|
1
|
writer_ = new XlsWriter(path2_);
|
50
|
|
}
|
51
|
|
|
52
|
1
|
[TearDown]
|
53
|
|
public void TearDown()
|
54
|
|
{
|
55
|
1
|
if (File.Exists(path2_))
|
56
|
|
{
|
57
|
1
|
File.Delete(path2_);
|
58
|
|
}
|
59
|
|
}
|
60
|
|
|
61
|
1
|
[Test]
|
62
|
|
public void TestWrite()
|
63
|
|
{
|
64
|
1
|
writer_.Write(dataSet_);
|
65
|
|
}
|
66
|
|
}
|
67
|
|
}
|
68
|
|
|