Skip to content

Commit c452533

Browse files
Reorganizing test data
- Moved test data from samples to tests/data and updated paths in test files - Moved MiniExcel.Tests.AspNetCore from tests to samples and renamed it to MiniExcel.Samples.AspNetCore - Removed AspNetMvc and WebForms samples
1 parent 9074ebd commit c452533

File tree

919 files changed

+123
-1059
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

919 files changed

+123
-1059
lines changed

tests/MiniExcel.Tests.AspNetCore/MiniExcel.Tests.AspNetCore.csproj renamed to samples/MiniExcel.Samples.AspNetCore/MiniExcel.Samples.AspNetCore.csproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
</PropertyGroup>
77

8-
<ItemGroup>
9-
<Compile Remove="wwwroot\**" />
10-
<Content Remove="wwwroot\**" />
11-
<EmbeddedResource Remove="wwwroot\**" />
12-
<None Remove="wwwroot\**" />
13-
</ItemGroup>
14-
158
<ItemGroup>
169
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
1710
</ItemGroup>

tests/MiniExcel.Tests.AspNetCore/MiniExcel.Tests.AspNetCore.sln renamed to samples/MiniExcel.Samples.AspNetCore/MiniExcel.Samples.AspNetCore.sln

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 16
44
VisualStudioVersion = 16.0.31025.194
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniExcel.Tests.AspNetCore", "MiniExcel.Tests.AspNetCore.csproj", "{B83FB32E-3BFE-40B7-A0B7-60CE06D477C9}"
7-
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniExcelLibs", "..\..\src\MiniExcel\MiniExcelLibs.csproj", "{C379147D-85E9-4C3D-8409-72FA989325C0}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniExcel.Samples.AspNetCore", "MiniExcel.Samples.AspNetCore.csproj", "{B83FB32E-3BFE-40B7-A0B7-60CE06D477C9}"
97
EndProject
108
Global
119
GlobalSection(SolutionConfigurationPlatforms) = preSolution

tests/MiniExcel.Tests.AspNetCore/Program.cs renamed to samples/MiniExcel.Samples.AspNetCore/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using System.Collections.Generic;
88
using System.IO;
99
using System.Net;
10-
using MiniExcelLib;
10+
using MiniExcelLibs;
1111
using Microsoft.AspNetCore.Http;
1212
using System.Text.Json.Serialization;
1313
using Newtonsoft.Json;

tests/MiniExcel.Tests.AspNetCore/Properties/launchSettings.json renamed to samples/MiniExcel.Samples.AspNetCore/Properties/launchSettings.json

File renamed without changes.

samples/xlsx/TestTemplateComplex.xlsx renamed to samples/MiniExcel.Samples.AspNetCore/TestTemplateComplex.xlsx

File renamed without changes.

tests/MiniExcel.Tests.AspNetCore/appsettings.Development.json renamed to samples/MiniExcel.Samples.AspNetCore/appsettings.Development.json

File renamed without changes.
File renamed without changes.

tests/LINQPad/ZipArchive Set Position.linq

Lines changed: 0 additions & 41 deletions
This file was deleted.

tests/MiniExcel.Core.Tests/MiniExcelIssueAsyncTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ public async Task Issue212()
778778
public async Task Issue207()
779779
{
780780
{
781-
const string templatePath = "../../../../../samples/xlsx/TestIssue207_2.xlsx";
781+
var templatePath = PathHelper.GetFile("xlsx/TestIssue207_2.xlsx");
782782
using var file = AutoDeletingPath.Create();
783783
var path = file.ToString();
784784

@@ -824,7 +824,7 @@ public async Task Issue207()
824824
}
825825

826826
{
827-
const string templatePath = "../../../../../samples/xlsx/TestIssue207_Template_Merge_row_list_rendering_without_merge/template.xlsx";
827+
var templatePath = PathHelper.GetFile("xlsx/TestIssue207_Template_Merge_row_list_rendering_without_merge/template.xlsx");
828828
using var file = AutoDeletingPath.Create();
829829
var path = file.ToString();
830830

@@ -863,7 +863,7 @@ public async Task Issue207()
863863
[Fact]
864864
public async Task Issue87()
865865
{
866-
const string templatePath = "../../../../../samples/xlsx/TestTemplateCenterEmpty.xlsx";
866+
var templatePath = PathHelper.GetFile("xlsx/TestTemplateCenterEmpty.xlsx");
867867
using var path = AutoDeletingPath.Create();
868868
var value = new
869869
{
@@ -883,7 +883,7 @@ public async Task Issue87()
883883
[Fact]
884884
public async Task Issue206()
885885
{
886-
const string templatePath = "../../../../../samples/xlsx/TestTemplateBasicIEmumerableFill.xlsx";
886+
var templatePath = PathHelper.GetFile("xlsx/TestTemplateBasicIEmumerableFill.xlsx");
887887
{
888888
using var path = AutoDeletingPath.Create();
889889

@@ -927,7 +927,7 @@ public async Task Issue206()
927927
public async Task Issue193()
928928
{
929929
{
930-
const string templatePath = "../../../../../samples/xlsx/TestTemplateComplexWithNamespacePrefix.xlsx";
930+
var templatePath = PathHelper.GetFile("xlsx/TestTemplateComplexWithNamespacePrefix.xlsx");
931931
using var file = AutoDeletingPath.Create();
932932
var path = file.ToString();
933933

@@ -982,7 +982,7 @@ public async Task Issue193()
982982
}
983983

984984
{
985-
const string templatePath = "../../../../../samples/xlsx/TestTemplateComplex.xlsx";
985+
var templatePath = PathHelper.GetFile("xlsx/TestTemplateComplex.xlsx");
986986
using var file = AutoDeletingPath.Create();
987987
var path = file.ToString();
988988

@@ -1031,8 +1031,8 @@ public async Task Issue193()
10311031
[Fact]
10321032
public async Task Issue142_Query()
10331033
{
1034-
const string path = "../../../../../samples/xlsx/TestIssue142.xlsx";
1035-
const string pathCsv = "../../../../../samples/xlsx/TestIssue142.csv";
1034+
var path = PathHelper.GetFile("xlsx/TestIssue142.xlsx");
1035+
var pathCsv = PathHelper.GetFile("xlsx/TestIssue142.csv");
10361036
{
10371037
var rows = _excelImporter.QueryAsync<Issue142VoExcelColumnNameNotFound>(path).ToBlockingEnumerable().ToList();
10381038
Assert.Equal(0, rows[0].MyProperty1);
@@ -1198,7 +1198,7 @@ public async Task Issue157()
11981198
Assert.Equal("Sheet1", p.Workbook.Worksheets["Sheet1"].Name);
11991199
}
12001200
{
1201-
const string path = "../../../../../samples/xlsx/TestIssue157.xlsx";
1201+
var path = PathHelper.GetFile("xlsx/TestIssue157.xlsx");
12021202
{
12031203
var q = _excelImporter.QueryAsync(path, sheetName: "Sheet1").ToBlockingEnumerable();
12041204
var rows = q.ToList();
@@ -1246,7 +1246,7 @@ public async Task Issue149()
12461246
var strings = chars.Select(s => s.ToString()).ToArray();
12471247

12481248
{
1249-
const string path = "../../../../../samples/xlsx/TestIssue149.xlsx";
1249+
var path = PathHelper.GetFile("xlsx/TestIssue149.xlsx");
12501250
var q = _excelImporter.QueryAsync(path).ToBlockingEnumerable();
12511251
var rows = q.Select(s => (string)s.A).ToList();
12521252

@@ -1311,7 +1311,7 @@ private class Issue149VO
13111311
[Fact]
13121312
public async Task Issue153()
13131313
{
1314-
const string path = "../../../../../samples/xlsx/TestIssue153.xlsx";
1314+
var path = PathHelper.GetFile("xlsx/TestIssue153.xlsx");
13151315
var q = _excelImporter.QueryAsync(path, true).ToBlockingEnumerable();
13161316
var rows = q.First() as IDictionary<string, object>;
13171317

@@ -1328,7 +1328,7 @@ public async Task Issue153()
13281328
[Fact]
13291329
public void Issue137()
13301330
{
1331-
const string path = "../../../../../samples/xlsx/TestIssue137.xlsx";
1331+
var path = PathHelper.GetFile("xlsx/TestIssue137.xlsx");
13321332
{
13331333
var q = _excelImporter.QueryAsync(path).ToBlockingEnumerable();
13341334
var rows = q.ToList();
@@ -1420,7 +1420,7 @@ private class Issue137ExcelRow
14201420
[Fact]
14211421
public void Issue138()
14221422
{
1423-
const string path = "../../../../../samples/xlsx/TestIssue138.xlsx";
1423+
var path = PathHelper.GetFile("xlsx/TestIssue138.xlsx");
14241424
{
14251425
var q = _excelImporter.QueryAsync(path, true).ToBlockingEnumerable();
14261426
var rows = q.ToList();

tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ UNION ALL
446446
}
447447

448448
{
449-
const string xlsxPath = "../../../../../samples/xlsx/Test5x2.xlsx";
449+
var xlsxPath = PathHelper.GetFile("xlsx/Test5x2.xlsx");
450450
using var tempSqlitePath = AutoDeletingPath.Create(Path.GetTempPath(), $"{Guid.NewGuid()}.db");
451451
var connectionString = $"Data Source={tempSqlitePath};Version=3;";
452452

@@ -2074,7 +2074,7 @@ public void Issue212()
20742074
public void Issue207()
20752075
{
20762076
{
2077-
const string tempaltePath = "../../../../../samples/xlsx/TestIssue207_2.xlsx";
2077+
var tempaltePath = PathHelper.GetFile("xlsx/TestIssue207_2.xlsx");
20782078
using var file = AutoDeletingPath.Create();
20792079
var path = file.ToString();
20802080

@@ -2118,7 +2118,7 @@ public void Issue207()
21182118
}
21192119

21202120
{
2121-
const string tempaltePath = "../../../../../samples/xlsx/TestIssue207_Template_Merge_row_list_rendering_without_merge/template.xlsx";
2121+
var tempaltePath = PathHelper.GetFile("xlsx/TestIssue207_Template_Merge_row_list_rendering_without_merge/template.xlsx");
21222122
using var file = AutoDeletingPath.Create();
21232123
var path = file.ToString();
21242124

@@ -2154,7 +2154,7 @@ public void Issue207()
21542154
[Fact]
21552155
public void Issue87()
21562156
{
2157-
const string templatePath = "../../../../../samples/xlsx/TestTemplateCenterEmpty.xlsx";
2157+
var templatePath = PathHelper.GetFile("xlsx/TestTemplateCenterEmpty.xlsx");
21582158
using var path = AutoDeletingPath.Create();
21592159
var value = new
21602160
{
@@ -2171,7 +2171,7 @@ public void Issue87()
21712171
[Fact]
21722172
public void Issue208()
21732173
{
2174-
const string path = "../../../../../samples/xlsx/TestIssue208.xlsx";
2174+
var path = PathHelper.GetFile("xlsx/TestIssue208.xlsx");
21752175
var columns = _excelImporter.GetColumnNames(path).ToList();
21762176
Assert.Equal(16384, columns.Count);
21772177
Assert.Equal("XFD", columns[16383]);
@@ -2184,7 +2184,7 @@ public void Issue208()
21842184
public void Issue206()
21852185
{
21862186
{
2187-
const string templatePath = "../../../../../samples/xlsx/TestTemplateBasicIEmumerableFill.xlsx";
2187+
var templatePath = PathHelper.GetFile("xlsx/TestTemplateBasicIEmumerableFill.xlsx");
21882188
using var path = AutoDeletingPath.Create();
21892189

21902190
var dt = new DataTable();
@@ -2203,7 +2203,7 @@ public void Issue206()
22032203
}
22042204

22052205
{
2206-
const string templatePath = "../../../../../samples/xlsx/TestTemplateBasicIEmumerableFill.xlsx";
2206+
var templatePath = PathHelper.GetFile("xlsx/TestTemplateBasicIEmumerableFill.xlsx");
22072207
using var path = AutoDeletingPath.Create();
22082208

22092209
using var dt = new DataTable();
@@ -2227,7 +2227,7 @@ public void Issue206()
22272227
public void Issue193()
22282228
{
22292229
{
2230-
const string templatePath = "../../../../../samples/xlsx/TestTemplateComplexWithNamespacePrefix.xlsx";
2230+
var templatePath = PathHelper.GetFile("xlsx/TestTemplateComplexWithNamespacePrefix.xlsx");
22312231
using var file = AutoDeletingPath.Create();
22322232
var path = file.ToString();
22332233

@@ -2281,7 +2281,7 @@ public void Issue193()
22812281
}
22822282

22832283
{
2284-
const string templatePath = "../../../../../samples/xlsx/TestTemplateComplex.xlsx";
2284+
var templatePath = PathHelper.GetFile("xlsx/TestTemplateComplex.xlsx");
22852285
using var path = AutoDeletingPath.Create();
22862286

22872287
// 2. By Dictionary
@@ -2405,7 +2405,7 @@ public void Issue157()
24052405
Assert.Equal("Sheet1", p.Workbook.Worksheets["Sheet1"].Name);
24062406
}
24072407
{
2408-
const string path = "../../../../../samples/xlsx/TestIssue157.xlsx";
2408+
var path = PathHelper.GetFile("xlsx/TestIssue157.xlsx");
24092409

24102410
{
24112411
var rows = _excelImporter.Query(path, sheetName: "Sheet1").ToList();
@@ -2452,7 +2452,7 @@ public void Issue149()
24522452
var strings = chars.Select(s => s.ToString()).ToArray();
24532453

24542454
{
2455-
const string path = "../../../../../samples/xlsx/TestIssue149.xlsx";
2455+
var path = PathHelper.GetFile("xlsx/TestIssue149.xlsx");
24562456
var rows = _excelImporter.Query(path).Select(s => (string)s.A).ToList();
24572457
for (int i = 0; i < chars.Length; i++)
24582458
{
@@ -2508,7 +2508,7 @@ private class Issue149VO
25082508
[Fact]
25092509
public void Issue153()
25102510
{
2511-
const string path = "../../../../../samples/xlsx/TestIssue153.xlsx";
2511+
var path = PathHelper.GetFile("xlsx/TestIssue153.xlsx");
25122512
var rows = _excelImporter.Query(path, true).First() as IDictionary<string, object>;
25132513
Assert.Equal(
25142514
[
@@ -2523,7 +2523,7 @@ public void Issue153()
25232523
[Fact]
25242524
public void Issue137()
25252525
{
2526-
const string path = "../../../../../samples/xlsx/TestIssue137.xlsx";
2526+
var path = PathHelper.GetFile("xlsx/TestIssue137.xlsx");
25272527
{
25282528
var rows = _excelImporter.Query(path).ToList();
25292529
var first = rows[0] as IDictionary<string, object>; // https://user-images.githubusercontent.com/12729184/113266322-ba06e400-9307-11eb-9521-d36abfda75cc.png
@@ -2609,7 +2609,7 @@ private class Issue137ExcelRow
26092609
[Fact]
26102610
public void Issue138()
26112611
{
2612-
const string path = "../../../../../samples/xlsx/TestIssue138.xlsx";
2612+
var path = PathHelper.GetFile("xlsx/TestIssue138.xlsx");
26132613
{
26142614
var rows = _excelImporter.Query(path, true).ToList();
26152615
Assert.Equal(6, rows.Count);
@@ -2885,7 +2885,7 @@ private class Issue585VO3
28852885
[Fact]
28862886
public void Issue585()
28872887
{
2888-
const string path = "../../../../../samples/xlsx/TestIssue585.xlsx";
2888+
var path = PathHelper.GetFile("xlsx/TestIssue585.xlsx");
28892889

28902890
var items1 = _excelImporter.Query<Issue585VO1>(path);
28912891
Assert.Equal(2, items1.Count());
@@ -2906,7 +2906,7 @@ private class Issue542
29062906
[Fact]
29072907
public void Issue_542()
29082908
{
2909-
const string path = "../../../../../samples/xlsx/TestIssue542.xlsx";
2909+
var path = PathHelper.GetFile("xlsx/TestIssue542.xlsx");
29102910

29112911
var resultWithoutFirstRow = _excelImporter.Query<Issue542>(path).ToList();
29122912
var resultWithFirstRow = _excelImporter.Query<Issue542>(path, treatHeaderAsData: true).ToList();
@@ -2960,7 +2960,7 @@ public void Issue606_1()
29602960
string.Concat(nameof(MiniExcelIssueTests), "_", nameof(Issue606_1), ".xlsx")
29612961
);
29622962

2963-
const string templateFileName = "../../../../../samples/xlsx/TestIssue606_Template.xlsx";
2963+
var templateFileName = PathHelper.GetFile("xlsx/TestIssue606_Template.xlsx");
29642964
_excelTemplater.ApplyTemplate(path, Path.GetFullPath(templateFileName), value);
29652965
File.Delete(path);
29662966
}
@@ -3134,7 +3134,7 @@ private class Issue697
31343134
[Fact]
31353135
public void Test_Issue_697_EmptyRowsStronglyTypedQuery()
31363136
{
3137-
const string path = "../../../../../samples/xlsx/TestIssue697.xlsx";
3137+
var path = PathHelper.GetFile("xlsx/TestIssue697.xlsx");
31383138
var rowsIgnoreEmpty = _excelImporter.Query<Issue697>(path, configuration: new OpenXmlConfiguration { IgnoreEmptyRows = true }).ToList();
31393139
var rowsCountEmpty = _excelImporter.Query<Issue697>(path).ToList();
31403140
Assert.Equal(4, rowsIgnoreEmpty.Count);
@@ -3167,9 +3167,9 @@ public void Issue_710()
31673167
[Fact]
31683168
public void Issue_732_First_Sheet_Active()
31693169
{
3170-
const string path1 = "../../../../../samples/xlsx/TestIssue732_1.xlsx";
3171-
const string path2 = "../../../../../samples/xlsx/TestIssue732_2.xlsx";
3172-
const string path3 = "../../../../../samples/xlsx/TestIssue732_3.xlsx";
3170+
var path1 = PathHelper.GetFile("xlsx/TestIssue732_1.xlsx");
3171+
var path2 = PathHelper.GetFile("xlsx/TestIssue732_2.xlsx");
3172+
var path3 = PathHelper.GetFile("xlsx/TestIssue732_3.xlsx");
31733173

31743174
var info1 = _excelImporter.GetSheetInformations(path1);
31753175
var info2 = _excelImporter.GetSheetInformations(path2);

0 commit comments

Comments
 (0)