Skip to content

Commit c4a7439

Browse files
authored
refactor: tests, bump target to netstandard2.0;net462;net6.0, move test data into sqlite. (#274)
* refactor: tests, bump target to netstandard2.0;net462;net6.0, move test data into sqlite. - Target netstandard2.0;net462;net6.0 (supported versions) (drop net40;net46) - Update testing dependencies - Migrate MDB data to sqlite (easier to run multiplatform/CI) * Task: Update appveyor image to VS2022
1 parent 203934d commit c4a7439

21 files changed

+166
-65
lines changed

ClosedXML.Report.sln

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27004.2006
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32414.318
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClosedXML.Report", "ClosedXML.Report\ClosedXML.Report.csproj", "{DEF4A219-D1CF-42A2-A5AC-FE7F2F005AB0}"
77
EndProject
@@ -11,8 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{8438BAA8
1111
EndProject
1212
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClosedXML.Report.Tests", "tests\ClosedXML.Report.Tests\ClosedXML.Report.Tests.csproj", "{D529A371-3AEA-4D02-9A0D-308A6276D411}"
1313
EndProject
14-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestRunner", "tests\TestRunner\TestRunner.csproj", "{43C972B0-8F93-474E-AD9C-E54FEEB71A9A}"
15-
EndProject
1614
Global
1715
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1816
Debug|Any CPU = Debug|Any CPU
@@ -32,20 +30,13 @@ Global
3230
{D529A371-3AEA-4D02-9A0D-308A6276D411}.Release.Signed|Any CPU.Build.0 = Release.Signed|Any CPU
3331
{D529A371-3AEA-4D02-9A0D-308A6276D411}.Release|Any CPU.ActiveCfg = Release|Any CPU
3432
{D529A371-3AEA-4D02-9A0D-308A6276D411}.Release|Any CPU.Build.0 = Release|Any CPU
35-
{43C972B0-8F93-474E-AD9C-E54FEEB71A9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36-
{43C972B0-8F93-474E-AD9C-E54FEEB71A9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
37-
{43C972B0-8F93-474E-AD9C-E54FEEB71A9A}.Release.Signed|Any CPU.ActiveCfg = Release.Signed|Any CPU
38-
{43C972B0-8F93-474E-AD9C-E54FEEB71A9A}.Release.Signed|Any CPU.Build.0 = Release.Signed|Any CPU
39-
{43C972B0-8F93-474E-AD9C-E54FEEB71A9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
40-
{43C972B0-8F93-474E-AD9C-E54FEEB71A9A}.Release|Any CPU.Build.0 = Release|Any CPU
4133
EndGlobalSection
4234
GlobalSection(SolutionProperties) = preSolution
4335
HideSolutionNode = FALSE
4436
EndGlobalSection
4537
GlobalSection(NestedProjects) = preSolution
4638
{DEF4A219-D1CF-42A2-A5AC-FE7F2F005AB0} = {885EF47A-C124-45F0-B979-303B30FB586B}
4739
{D529A371-3AEA-4D02-9A0D-308A6276D411} = {8438BAA8-E968-4C14-9500-E3A52434E32A}
48-
{43C972B0-8F93-474E-AD9C-E54FEEB71A9A} = {8438BAA8-E968-4C14-9500-E3A52434E32A}
4940
EndGlobalSection
5041
GlobalSection(ExtensibilityGlobals) = postSolution
5142
SolutionGuid = {42DA0EC5-D733-4746-9613-413A64EEDC4B}

ClosedXML.Report/ClosedXML.Report.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net40;net46</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;net462;net6.0</TargetFrameworks>
55
<LangVersion>Latest</LangVersion>
66
<AssemblyName>ClosedXML.Report</AssemblyName>
77
<PackageId>ClosedXML.Report</PackageId>
@@ -60,9 +60,9 @@
6060

6161
<ItemGroup>
6262
<PackageReference Include="ClosedXML.Signed" Version="0.95.0" Condition="'$(Configuration)'=='Release.Signed'" />
63-
<PackageReference Include="ClosedXML" Version="0.95.0" Condition="'$(Configuration)'!='Release.Signed'" />
64-
<PackageReference Include="morelinq" Version="2.10.0" />
65-
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.10" />
63+
<PackageReference Include="ClosedXML" Version="0.95.4" Condition="'$(Configuration)'!='Release.Signed'" />
64+
<PackageReference Include="morelinq" Version="3.3.2" />
65+
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.18" />
6666
</ItemGroup>
6767

6868
</Project>

ClosedXML.Report/Utils/StringExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static string ReplaceLast(this string source, string find, string replace
2525
}
2626

2727
/// <summary>
28-
/// Matching all capital letters in the input and seperate them with spaces to form a sentence.
28+
/// Matching all capital letters in the input and separate them with spaces to form a sentence.
2929
/// If the input is an abbreviation text, no space will be added and returns the same input.
3030
/// </summary>
3131
/// <example>
@@ -156,4 +156,4 @@ public static string Format(this string stringFormat, params object[] pars)
156156
return string.Format(stringFormat, pars);
157157
}
158158
}
159-
}
159+
}

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ version: 0.2.0.{build}
55
pull_requests:
66
do_not_increment_build_number: true
77

8-
os: Visual Studio 2019
9-
image: Visual Studio 2019
8+
os: Visual Studio 2022
9+
image: Visual Studio 2022
1010
skip_branch_with_pr: true
1111

1212
environment:
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<connectionStrings>
4-
<add name="Default" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\..\..\..\DB\dbdemos.mdb;Locale Identifier=1033;Jet OLEDB:Engine Type=5;Persist Security Info=True" providerName="Access"/>
5-
<!--<add name="DefaultConnection" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=..\..\..\DB\dbdemos.mdb;Persist Security Info=False;"
6-
providerName="JetEntityFrameworkProvider"/>-->
4+
<add name="Default" connectionString="Data Source=..\..\..\..\DB\dbdemos.sqlite;Version=3;" providerName="SQLite"/>
75
</connectionStrings>
86
<system.data>
97
<DbProviderFactories>
108
</DbProviderFactories>
119
</system.data>
12-
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration>
10+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>

tests/ClosedXML.Report.Tests/ClosedXML.Report.Tests.csproj

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net452</TargetFrameworks>
3+
<TargetFrameworks>net462;net6.0</TargetFrameworks>
44
<LangVersion>Latest</LangVersion>
55
<Configurations>Debug;Release;Release.Signed</Configurations>
66
<PackageLicenseUrl>https://github.com/ClosedXML/ClosedXML.Report/blob/master/LICENSE</PackageLicenseUrl>
@@ -20,7 +20,7 @@
2020
<DefineConstants>$(DefineConstants);RELEASE;STRONGNAME</DefineConstants>
2121
</PropertyGroup>
2222

23-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net452|AnyCPU'">
23+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
2424
<PlatformTarget>AnyCPU</PlatformTarget>
2525
</PropertyGroup>
2626

@@ -29,19 +29,26 @@
2929
</ItemGroup>
3030

3131
<ItemGroup>
32-
<PackageReference Include="Bogus" Version="33.0.2" />
33-
<PackageReference Include="DocumentFormat.OpenXml" Version="2.7.2" />
34-
<PackageReference Include="FluentAssertions" Version="4.18.0" />
35-
<PackageReference Include="linq2db" Version="1.0.7.1" />
36-
<PackageReference Include="linq2db.Access" Version="1.7.6" />
37-
<PackageReference Include="linq2db.t4models" Version="1.0.7.1" />
38-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
39-
<PackageReference Include="NSubstitute" Version="1.10.0.0" />
40-
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.10" />
32+
<PackageReference Include="Bogus" Version="34.0.2" />
33+
<PackageReference Include="DocumentFormat.OpenXml" Version="2.16.0" />
34+
<PackageReference Include="FluentAssertions" Version="6.7.0" />
35+
<PackageReference Include="linq2db" Version="3.7.0" />
36+
<PackageReference Include="linq2db.SQLite" Version="3.7.0" />
37+
<PackageReference Include="linq2db.t4models" Version="3.7.0" />
38+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
39+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
40+
<PackageReference Include="NSubstitute" Version="4.3.0" />
41+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
42+
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.18" />
43+
<PackageReference Include="System.Resources.Extensions" Version="6.0.0" />
44+
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" />
4145
<PackageReference Include="xunit" Version="2.4.1" />
4246
<PackageReference Include="xunit.assert" Version="2.4.1" />
4347
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
44-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
48+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
49+
<PrivateAssets>all</PrivateAssets>
50+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
51+
</PackageReference>
4552
</ItemGroup>
4653

4754
<ItemGroup>
@@ -50,9 +57,6 @@
5057

5158
<ItemGroup>
5259
<ProjectReference Include="..\..\ClosedXML.Report\ClosedXML.Report.csproj" />
53-
<Reference Include="System.ComponentModel.DataAnnotations" />
54-
<Reference Include="System.Data.DataSetExtensions" />
55-
<Reference Include="WindowsBase" />
5660
</ItemGroup>
5761

5862
<ItemGroup>
@@ -69,4 +73,10 @@
6973
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
7074
</EmbeddedResource>
7175
</ItemGroup>
76+
77+
<ItemGroup>
78+
<None Update="appsettings.json">
79+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
80+
</None>
81+
</ItemGroup>
7282
</Project>

tests/ClosedXML.Report.Tests/DbContextTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
namespace ClosedXML.Report.Tests
77
{
8+
9+
[Collection("Database")]
810
public class DbContextTests
911
{
1012
[Fact]
@@ -25,4 +27,4 @@ public void Orders_should_not_be_empty()
2527
}
2628
}
2729
}
28-
}
30+
}

tests/ClosedXML.Report.Tests/GroupTagTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
namespace ClosedXML.Report.Tests
1010
{
11+
[Collection("Database")]
1112
public class GroupTagTests : XlsxTemplateTestsBase
1213
{
1314
public GroupTagTests(ITestOutputHelper output) : base(output)
@@ -86,7 +87,7 @@ public void Customers(string templateFile)
8687
{
8788
using (var db = new DbDemos())
8889
{
89-
var orders = db.orders.LoadWith(x => x.Customer);
90+
var orders = db.orders.LoadWith(x => x.Customer).ToList();
9091
tpl.AddVariable("Orders", orders);
9192
}
9293
},

tests/ClosedXML.Report.Tests/PivotTests.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
1+
using System.Linq;
42
using ClosedXML.Excel;
53
using ClosedXML.Report.Tests.TestModels;
64
using Xunit;
75
using Xunit.Abstractions;
86

97
namespace ClosedXML.Report.Tests
108
{
9+
[Collection("Database")]
1110
public class PivotTests : XlsxTemplateTestsBase
1211
{
1312
public PivotTests(ITestOutputHelper output) : base(output)
@@ -24,8 +23,16 @@ public void Simple(string templateFile)
2423
{
2524
using (var db = new DbDemos())
2625
{
27-
var rows = from o in db.orders
28-
select new {o.Customer.Company, o.PaymentMethod, OrderNo = o.OrderNo.ToString(), o.ShipDate, o.ItemsTotal, o.TaxRate, o.AmountPaid};
26+
var rows = db.orders.Select(o => new
27+
{
28+
o.Customer.Company,
29+
o.PaymentMethod,
30+
OrderNo = o.OrderNo.ToString(),
31+
o.ShipDate,
32+
o.ItemsTotal,
33+
o.TaxRate,
34+
o.AmountPaid
35+
}).ToList();
2936
tpl.AddVariable("Orders", rows);
3037
}
3138
},

tests/ClosedXML.Report.Tests/SubrangesTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.IO;
43
using System.Linq;
54
using ClosedXML.Report.Tests.TestModels;
65
using LinqToDB;
@@ -9,6 +8,8 @@
98

109
namespace ClosedXML.Report.Tests
1110
{
11+
12+
[Collection("Database")]
1213
public class SubrangesTests : XlsxTemplateTestsBase
1314
{
1415
[Theory,

0 commit comments

Comments
 (0)