diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests.csproj b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests.csproj new file mode 100644 index 000000000..ae6eda819 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests.csproj @@ -0,0 +1,20 @@ + + + + net9.0 + + false + Debug;Release + AnyCPU + + + + + + + + + + + + diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests.sln b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests.sln new file mode 100644 index 000000000..3efe62149 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.2.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests", "LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests.csproj", "{F760B606-3243-2655-8219-F8799FFAE4AF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F760B606-3243-2655-8219-F8799FFAE4AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F760B606-3243-2655-8219-F8799FFAE4AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F760B606-3243-2655-8219-F8799FFAE4AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F760B606-3243-2655-8219-F8799FFAE4AF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E1CB4316-1F23-4B1A-B67C-322A416FD6F5} + EndGlobalSection +EndGlobal diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN/Abp/Exporter/Pdf/LibreOffice/AbpExporterPdfLibreOfficeTestBase.cs b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN/Abp/Exporter/Pdf/LibreOffice/AbpExporterPdfLibreOfficeTestBase.cs new file mode 100644 index 000000000..652982b63 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN/Abp/Exporter/Pdf/LibreOffice/AbpExporterPdfLibreOfficeTestBase.cs @@ -0,0 +1,6 @@ +using LINGYUN.Abp.Tests; + +namespace LINGYUN.Abp.Exporter.Pdf.LibreOffice; +public abstract class AbpExporterPdfLibreOfficeTestBase : AbpTestsBase +{ +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN/Abp/Exporter/Pdf/LibreOffice/AbpExporterPdfLibreOfficeTestsModule.cs b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN/Abp/Exporter/Pdf/LibreOffice/AbpExporterPdfLibreOfficeTestsModule.cs new file mode 100644 index 000000000..ea288dfe0 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN/Abp/Exporter/Pdf/LibreOffice/AbpExporterPdfLibreOfficeTestsModule.cs @@ -0,0 +1,20 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Autofac; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Exporter.Pdf.LibreOffice; + +[DependsOn( + typeof(AbpExporterPdfLibreOfficeModule), + typeof(AbpExporterPdfTestsModule), + typeof(AbpAutofacModule))] +public class AbpExporterPdfLibreOfficeTestsModule : AbpModule +{ + public override void PreConfigureServices(ServiceConfigurationContext context) + { + if (!LibreOfficeCommands.IsLibreOffliceInstalled()) + { + context.Services.AddSingleton(); + } + } +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN/Abp/Exporter/Pdf/LibreOffice/AbpExporterPdfLibreOffice_Tests.cs b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN/Abp/Exporter/Pdf/LibreOffice/AbpExporterPdfLibreOffice_Tests.cs new file mode 100644 index 000000000..0112e9d65 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.LibreOffice.Tests/LINGYUN/Abp/Exporter/Pdf/LibreOffice/AbpExporterPdfLibreOffice_Tests.cs @@ -0,0 +1,5 @@ +namespace LINGYUN.Abp.Exporter.Pdf.LibreOffice; +public class AbpExporterPdfLibreOffice_Tests : ExcelToPdfProvider_Tests +{ + +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests.csproj b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests.csproj new file mode 100644 index 000000000..689bb3861 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests.csproj @@ -0,0 +1,20 @@ + + + + net9.0 + + false + Debug;Release + AnyCPU + + + + + + + + + + + + diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN/Abp/Exporter/Pdf/SpireLib/AbpExporterPdfSpireLibTestBase.cs b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN/Abp/Exporter/Pdf/SpireLib/AbpExporterPdfSpireLibTestBase.cs new file mode 100644 index 000000000..2dddc4d1a --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN/Abp/Exporter/Pdf/SpireLib/AbpExporterPdfSpireLibTestBase.cs @@ -0,0 +1,6 @@ +using LINGYUN.Abp.Tests; + +namespace LINGYUN.Abp.Exporter.Pdf.SpireLib; +public abstract class AbpExporterPdfSpireLibTestBase : AbpTestsBase +{ +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN/Abp/Exporter/Pdf/SpireLib/AbpExporterPdfSpireLibTestsModule.cs b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN/Abp/Exporter/Pdf/SpireLib/AbpExporterPdfSpireLibTestsModule.cs new file mode 100644 index 000000000..c474d59e1 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN/Abp/Exporter/Pdf/SpireLib/AbpExporterPdfSpireLibTestsModule.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Autofac; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Exporter.Pdf.SpireLib; + +[DependsOn( + typeof(AbpExporterPdfSpireLibModule), + typeof(AbpExporterPdfTestsModule), + typeof(AbpAutofacModule))] +public class AbpExporterPdfSpireLibTestsModule : AbpModule +{ +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN/Abp/Exporter/Pdf/SpireLib/AbpExporterSpireLibOffice_Tests.cs b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN/Abp/Exporter/Pdf/SpireLib/AbpExporterSpireLibOffice_Tests.cs new file mode 100644 index 000000000..ea5b95912 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.SpireLib.Tests/LINGYUN/Abp/Exporter/Pdf/SpireLib/AbpExporterSpireLibOffice_Tests.cs @@ -0,0 +1,5 @@ +namespace LINGYUN.Abp.Exporter.Pdf.SpireLib; +public class AbpExporterSpireLibOffice_Tests : ExcelToPdfProvider_Tests +{ + +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN.Abp.Exporter.Pdf.Tests.csproj b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN.Abp.Exporter.Pdf.Tests.csproj new file mode 100644 index 000000000..20265586e --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN.Abp.Exporter.Pdf.Tests.csproj @@ -0,0 +1,25 @@ + + + + net9.0 + true + false + + + + + + + + + + + + + + + + + + + diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/AbpExporterPdfTestBase.cs b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/AbpExporterPdfTestBase.cs new file mode 100644 index 000000000..106f6c55b --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/AbpExporterPdfTestBase.cs @@ -0,0 +1,8 @@ +using Volo.Abp.Modularity; +using Volo.Abp.Testing; + +namespace LINGYUN.Abp.Exporter.Pdf; +public abstract class AbpExporterPdfTestBase : AbpIntegratedTest + where TStartupModule : IAbpModule +{ +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/AbpExporterPdfTestsModule.cs b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/AbpExporterPdfTestsModule.cs new file mode 100644 index 000000000..15e901cb9 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/AbpExporterPdfTestsModule.cs @@ -0,0 +1,20 @@ +using LINGYUN.Abp.Tests; +using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; + +namespace LINGYUN.Abp.Exporter.Pdf; + +[DependsOn( + typeof(AbpVirtualFileSystemModule), + typeof(AbpExporterPdfModule), + typeof(AbpTestsBaseModule))] +public class AbpExporterPdfTestsModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + } +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/ExcelToPdfProvider_Tests.cs b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/ExcelToPdfProvider_Tests.cs new file mode 100644 index 000000000..725da41f3 --- /dev/null +++ b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/ExcelToPdfProvider_Tests.cs @@ -0,0 +1,34 @@ +using Shouldly; +using System.IO; +using System.Threading.Tasks; +using Volo.Abp.IO; +using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; +using Xunit; + +namespace LINGYUN.Abp.Exporter.Pdf; +public abstract class ExcelToPdfProvider_Tests : AbpExporterPdfTestBase + where TStartupModule : IAbpModule +{ + private readonly IExcelToPdfProvider _excelToPdfProvider; + private readonly IVirtualFileProvider _virtualFileProvider; + public ExcelToPdfProvider_Tests() + { + _excelToPdfProvider = GetRequiredService(); + _virtualFileProvider = GetRequiredService(); + } + + [Fact] + public async virtual Task Should_Parsed() + { + var excelFileInfo = _virtualFileProvider.GetFileInfo("/LINGYUN/Abp/Exporter/Pdf/Resources/test.xlsx"); + using (var excelStream = excelFileInfo.CreateReadStream()) + { + using (var pdfStream = await _excelToPdfProvider.ParseAsync(excelStream)) + { + pdfStream.Seek(0, System.IO.SeekOrigin.Begin); + pdfStream.Length.ShouldBePositive(); + } + } + } +} diff --git a/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/Resources/test.xlsx b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/Resources/test.xlsx new file mode 100644 index 000000000..029db08db Binary files /dev/null and b/aspnet-core/tests/LINGYUN.Abp.Exporter.Pdf.Tests/LINGYUN/Abp/Exporter/Pdf/Resources/test.xlsx differ