-
-
Notifications
You must be signed in to change notification settings - Fork 385
Expand file tree
/
Copy pathHtml2PdfServiceTest.cs
More file actions
34 lines (29 loc) · 1.27 KB
/
Html2PdfServiceTest.cs
File metadata and controls
34 lines (29 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License
// See the LICENSE file in the project root for more information.
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
namespace UnitTest.Services;
public class Html2PdfServiceTest
{
[Fact]
public async Task ExportPdf_Error()
{
var serviceCollection = new ServiceCollection();
serviceCollection.AddBootstrapBlazor();
var provider = serviceCollection.BuildServiceProvider();
var pdfService = provider.GetRequiredService<IHtml2Pdf>();
await Assert.ThrowsAsync<NotImplementedException>(() => pdfService.PdfDataAsync("https://www.baidu.com"));
await Assert.ThrowsAsync<NotImplementedException>(() => pdfService.PdfStreamAsync("https://www.baidu.com"));
await Assert.ThrowsAsync<NotImplementedException>(() => pdfService.PdfDataFromHtmlAsync("<h2>Test</h2>"));
await Assert.ThrowsAsync<NotImplementedException>(() => pdfService.PdfStreamFromHtmlAsync("<h2>Test</h2>"));
}
[Fact]
public void PdfOptions_Ok()
{
var options = new PdfOptions
{
Landscape = true
};
Assert.True(options.Landscape);
}
}