14 changed files with 205 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net9.0</TargetFramework> |
|||
<RootNamespace /> |
|||
<IsPackable>false</IsPackable> |
|||
<Configurations>Debug;Release</Configurations> |
|||
<Platforms>AnyCPU</Platforms> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\framework\exporter\LINGYUN.Abp.Exporter.Pdf.LibreOffice\LINGYUN.Abp.Exporter.Pdf.LibreOffice.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.Exporter.Pdf.Tests\LINGYUN.Abp.Exporter.Pdf.Tests.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -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 |
|||
@ -0,0 +1,6 @@ |
|||
using LINGYUN.Abp.Tests; |
|||
|
|||
namespace LINGYUN.Abp.Exporter.Pdf.LibreOffice; |
|||
public abstract class AbpExporterPdfLibreOfficeTestBase : AbpTestsBase<AbpExporterPdfLibreOfficeTestsModule> |
|||
{ |
|||
} |
|||
@ -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<LibreOfficeTestEnvironment>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
namespace LINGYUN.Abp.Exporter.Pdf.LibreOffice; |
|||
public class AbpExporterPdfLibreOffice_Tests : ExcelToPdfProvider_Tests<AbpExporterPdfLibreOfficeTestsModule> |
|||
{ |
|||
|
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net9.0</TargetFramework> |
|||
<RootNamespace /> |
|||
<IsPackable>false</IsPackable> |
|||
<Configurations>Debug;Release</Configurations> |
|||
<Platforms>AnyCPU</Platforms> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\framework\exporter\LINGYUN.Abp.Exporter.Pdf.SpireLib\LINGYUN.Abp.Exporter.Pdf.SpireLib.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.Exporter.Pdf.Tests\LINGYUN.Abp.Exporter.Pdf.Tests.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,6 @@ |
|||
using LINGYUN.Abp.Tests; |
|||
|
|||
namespace LINGYUN.Abp.Exporter.Pdf.SpireLib; |
|||
public abstract class AbpExporterPdfSpireLibTestBase : AbpTestsBase<AbpExporterPdfSpireLibTestsModule> |
|||
{ |
|||
} |
|||
@ -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 |
|||
{ |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
namespace LINGYUN.Abp.Exporter.Pdf.SpireLib; |
|||
public class AbpExporterSpireLibOffice_Tests : ExcelToPdfProvider_Tests<AbpExporterPdfSpireLibTestsModule> |
|||
{ |
|||
|
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net9.0</TargetFramework> |
|||
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> |
|||
<IsPackable>false</IsPackable> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Remove="LINGYUN\Abp\Exporter\Pdf\Resources\test.xlsx" /> |
|||
<EmbeddedResource Include="LINGYUN\Abp\Exporter\Pdf\Resources\test.xlsx" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> |
|||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\framework\exporter\LINGYUN.Abp.Exporter.Pdf\LINGYUN.Abp.Exporter.Pdf.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.TestBase\LINGYUN.Abp.TestsBase.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,8 @@ |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Testing; |
|||
|
|||
namespace LINGYUN.Abp.Exporter.Pdf; |
|||
public abstract class AbpExporterPdfTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule> |
|||
where TStartupModule : IAbpModule |
|||
{ |
|||
} |
|||
@ -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<AbpVirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<AbpExporterPdfTestsModule>(); |
|||
}); |
|||
} |
|||
} |
|||
@ -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<TStartupModule> : AbpExporterPdfTestBase<TStartupModule> |
|||
where TStartupModule : IAbpModule |
|||
{ |
|||
private readonly IExcelToPdfProvider _excelToPdfProvider; |
|||
private readonly IVirtualFileProvider _virtualFileProvider; |
|||
public ExcelToPdfProvider_Tests() |
|||
{ |
|||
_excelToPdfProvider = GetRequiredService<IExcelToPdfProvider>(); |
|||
_virtualFileProvider = GetRequiredService<IVirtualFileProvider>(); |
|||
} |
|||
|
|||
[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(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Binary file not shown.
Loading…
Reference in new issue