-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSamples.cs
More file actions
87 lines (65 loc) · 1.95 KB
/
Copy pathSamples.cs
File metadata and controls
87 lines (65 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using ClosedXML.Excel;
[TestFixture]
public class Samples
{
[Test]
public Task ScrubbingWithoutFormat() =>
VerifyFile("sample_scrubbingWithoutFormat.xlsx");
[Test]
public Task ScrubbingWithoutFormatDisableDateCounting() =>
VerifyFile("sample_scrubbingWithoutFormat.xlsx")
.DisableDateCounting();
[Test]
public Task ScrubbingWithoutFormatDontScrubDateTimes() =>
VerifyFile("sample_scrubbingWithoutFormat.xlsx")
.DontScrubDateTimes();
[Test]
public Task ScrubbingWithoutFormatDontScrubGuids() =>
VerifyFile("sample_scrubbingWithoutFormat.xlsx")
.DontScrubGuids();
[Test]
public Task DontScrub() =>
VerifyFile("sample.xlsx")
.DontScrubGuids().DontScrubDateTimes();
#region VerifyExcel
[Test]
public Task VerifyExcel() =>
VerifyFile("sample.xlsx");
#endregion
[Test]
public Task MultipleSheets() =>
VerifyFile("sample_multiple_sheets.xlsx");
[Test]
public Task HiddenRow() =>
VerifyFile("sample_hidden_row.xlsx");
#region XLWorkbook
[Test]
public Task XLWorkbook()
{
using var book = new XLWorkbook();
var sheet = book.Worksheets.Add("Basic Data");
sheet.Cell("A1").Value = "ID";
sheet.Cell("B1").Value = "Name";
sheet.Cell("A2").Value = 1;
sheet.Cell("B2").Value = "John Doe";
sheet.Cell("A3").Value = 2;
sheet.Cell("B3").Value = "Jane Smith";
return Verify(book);
}
#endregion
[Test]
public Task XLWorkbookFromStream()
{
using var stream = File.OpenRead("sample.xlsx");
using var book = new XLWorkbook(stream);
return Verify(book);
}
#region VerifyExcelStream
[Test]
public Task VerifyExcelStream()
{
var stream = new MemoryStream(File.ReadAllBytes("sample.xlsx"));
return Verify(stream, "xlsx");
}
#endregion
}