1- using System . Net . Http . Headers ;
2- using EmailPreviewServices ;
1+ using EmailPreviewServices ;
32
43[ TestFixture ]
54public class Samples
65{
7- static string ? apiKey = Environment . GetEnvironmentVariable ( "EmailPreviewServicesApiKey" ) ;
8- [ Test ]
9- public async Task DeviceList ( )
6+ static readonly EmailPreviewServicesClient service ;
7+
8+ static Samples ( )
109 {
10+ var apiKey = Environment . GetEnvironmentVariable ( "EmailPreviewServicesApiKey" ) ! ;
1111 var httpClient = new HttpClient ( ) ;
1212 httpClient . DefaultRequestHeaders . Add ( "X-API-Key" , apiKey ) ;
1313 httpClient . DefaultRequestHeaders . Authorization = new ( "Bearer" , apiKey ) ;
1414 httpClient . DefaultRequestHeaders . Accept . Add ( new ( "application/json" ) ) ;
15- var service = new EmailPreviewServicesClient ( "https://app.emailpreviewservices.com/api" , httpClient ) ;
16- var deviceListAsync = await service . GetDeviceListAsync ( ) ;
17- await Verify ( deviceListAsync ) ;
15+ service = new ( "https://app.emailpreviewservices.com/api" , httpClient ) ;
1816 }
17+ [ Test ]
18+ public async Task DeviceList ( )
19+ {
20+ var devices = await service . GetDeviceListAsync ( ) ;
21+ await Verify ( devices ) ;
22+ }
23+
1924 [ Test ]
2025 public async Task Simple ( )
2126 {
22- // var html =
23- // """
24- // <!DOCTYPE html>
25- // <html>
26- // <head>
27- // <meta charset="UTF-8">
28- // <meta name="viewport" content="width=device-width, initial-scale=1.0">
29- // <title>Test Email</title>
30- // </head>
31- // <body style="font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 20px;">
32- // <div style="max-width: 600px; margin: 0 auto; background-color: white; padding: 20px; border-radius: 10px;">
33- // <h1 style="color: #333;">Welcome to Our Service!</h1>
34- // <p style="color: #666; line-height: 1.6;">
35- // This is a test email to demonstrate the email preview functionality.
36- // </p>
37- // <a href="https://example.com"
38- // style="display: inline-block; padding: 10px 20px; background-color: #007bff;
39- // color: white; text-decoration: none; border-radius: 5px; margin-top: 10px;">
40- // Get Started
41- // </a>
42- // <p style="color: #999; font-size: 12px; margin-top: 30px;">
43- // © 2025 Your Company. All rights reserved.
44- // </p>
45- // </div>
46- // </body>
47- // </html>
48- // """;
27+ var html =
28+ """
29+ <!DOCTYPE html>
30+ <html>
31+ <head>
32+ <meta charset="UTF-8">
33+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
34+ <title>Test Email</title>
35+ </head>
36+ <body style="font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 20px;">
37+ <div style="max-width: 600px; margin: 0 auto; background-color: white; padding: 20px; border-radius: 10px;">
38+ <h1 style="color: #333;">Welcome to Our Service!</h1>
39+ <p style="color: #666; line-height: 1.6;">
40+ This is a test email to demonstrate the email preview functionality.
41+ </p>
42+ <a href="https://example.com"
43+ style="display: inline-block; padding: 10px 20px; background-color: #007bff;
44+ color: white; text-decoration: none; border-radius: 5px; margin-top: 10px;">
45+ Get Started
46+ </a>
47+ <p style="color: #999; font-size: 12px; margin-top: 30px;">
48+ © 2025 Your Company. All rights reserved.
49+ </p>
50+ </div>
51+ </body>
52+ </html>
53+ """ ;
4954
50- var httpClient = new HttpClient ( ) ;
51- httpClient . DefaultRequestHeaders . Add ( "X-API-Key" , apiKey ) ;
52- var service = new EmailPreviewServicesClient ( "app.emailpreviewservices.com" , httpClient ) ;
53- var deviceListAsync = await service . GetDeviceListAsync ( ) ;
55+ var deviceListAsync = await service . PreGetDeviceListAsync ( ) ;
5456 await Verify ( deviceListAsync ) ;
5557 }
5658}
0 commit comments