我正在开发 .net5.0 Web api,在使用 DinkToPdf 时收到以下错误:
DllNotFoundException:无法加载 DLL“libwkhtmltox”或其依赖项之一:找不到指定的模块。(0x8007007E)
我已遵循本教程,但有一些例外:
添加了服务 添加了服务,教程中没有做
services.AddSingleton(typeof(IConverter),
new SynchronizedConverter(new PdfTools()));
...
services.AddScoped<IPdfService, PdfService>();
Run Code Online (Sandbox Code Playgroud)
服务的命名不同,但这并不重要
通过 NuGet 安装它而不是Install-Package DinkToPdf
我的项目只是一个 API,前端不是用 C# 编写的,应该没关系,因为错误在这里:
return this._converter.Convert(htmlToPdfDocument);
Run Code Online (Sandbox Code Playgroud)
其他一切都按照教程中的方式进行。
假设我在组件中订阅了路由参数:
this.route.params.subscribe((params) => {
// what the params object holds
// params.id1 params.id2
// what the current route looks like
//localhost/params.id1/params.id2
});
Run Code Online (Sandbox Code Playgroud)
我如何params.id2在 Angular 中进行单元测试?示例:我想测试 params.id2 > 0
目前我已经这样做了:
// top of the describe
let route: ActivatedRoute;
//inside the TestBed.configureTestingModule
providers: [
{
provide: ActivatedRoute,
useValue: {
params: of({
id1: 1,
id2: 0,
}),
},
},
],
route = TestBed.inject(ActivatedRoute);
it('shouldn't be zero', () => {
// i want to check if params.id2 is not zero
expect(params.id2).not.toBe(0);
}); …Run Code Online (Sandbox Code Playgroud)