Skip to content

Commit 88fc29b

Browse files
Update skipped tests to use Skip.Test() instead of early return
Co-authored-by: JohnCampionJr <1094820+JohnCampionJr@users.noreply.github.com>
1 parent 7f1f089 commit 88fc29b

File tree

6 files changed

+47
-47
lines changed

6 files changed

+47
-47
lines changed

test/FluentEmail.Core.Tests/ThirdParty/AzureEmailSenderTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public AzureEmailSenderTests()
2727
[Test]
2828
public async Task CanSendEmail()
2929
{
30-
if (string.IsNullOrEmpty(_connectionString)) return; // Skip: No Azure Credentials
30+
if (string.IsNullOrEmpty(_connectionString)) Skip.Test("No Azure Credentials");
3131

3232
const string subject = "SendMail Test";
3333
const string body = "This email is testing send mail functionality of Azure Email Sender.";
@@ -47,7 +47,7 @@ public async Task CanSendEmail()
4747
[Test]
4848
public async Task CanSendEmailWithReplyTo()
4949
{
50-
if (string.IsNullOrEmpty(_connectionString)) return; // Skip: No Azure Credentials
50+
if (string.IsNullOrEmpty(_connectionString)) Skip.Test("No Azure Credentials");
5151

5252
const string subject = "SendMail Test";
5353
const string body = "This email is testing send mail with ReplyTo functionality of Azure Email Sender.";
@@ -68,7 +68,7 @@ public async Task CanSendEmailWithReplyTo()
6868
[Test]
6969
public async Task CanSendEmailWithAttachments()
7070
{
71-
if (string.IsNullOrEmpty(_connectionString)) return; // Skip: No Azure Credentials
71+
if (string.IsNullOrEmpty(_connectionString)) Skip.Test("No Azure Credentials");
7272

7373
const string subject = "SendMail With Attachments Test";
7474
const string body = "This email is testing the attachment functionality of Azure Email Sender.";
@@ -98,7 +98,7 @@ public async Task CanSendEmailWithAttachments()
9898
[Test]
9999
public async Task CanSendHighPriorityEmail()
100100
{
101-
if (string.IsNullOrEmpty(_connectionString)) return; // Skip: No Azure Credentials
101+
if (string.IsNullOrEmpty(_connectionString)) Skip.Test("No Azure Credentials");
102102

103103
const string subject = "SendMail Test";
104104
const string body = "This email is testing send mail functionality of Azure Email Sender.";
@@ -119,7 +119,7 @@ public async Task CanSendHighPriorityEmail()
119119
[Test]
120120
public async Task CanSendLowPriorityEmail()
121121
{
122-
if (string.IsNullOrEmpty(_connectionString)) return; // Skip: No Azure Credentials
122+
if (string.IsNullOrEmpty(_connectionString)) Skip.Test("No Azure Credentials");
123123

124124
const string subject = "SendMail Test";
125125
const string body = "This email is testing send mail functionality of Azure Email Sender.";

test/FluentEmail.Core.Tests/ThirdParty/GraphSenderTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public GraphSenderTests()
3232
[Test]
3333
public void CanSendEmail()
3434
{
35-
if (string.IsNullOrEmpty(_appId)) return; // Skip: No Graph/AD Credentials
35+
if (string.IsNullOrEmpty(_appId)) Skip.Test("No Graph/AD Credentials");
3636

3737
var email = Email
3838
.From(_senderEmail)
@@ -48,7 +48,7 @@ public void CanSendEmail()
4848
[Test]
4949
public async Task CanSendEmailAsync()
5050
{
51-
if (string.IsNullOrEmpty(_appId)) return; // Skip: No Graph/AD Credentials
51+
if (string.IsNullOrEmpty(_appId)) Skip.Test("No Graph/AD Credentials");
5252

5353
var email = Email
5454
.From(_senderEmail)
@@ -64,7 +64,7 @@ public async Task CanSendEmailAsync()
6464
[Test]
6565
public async Task CanSendEmailWithAttachments()
6666
{
67-
if (string.IsNullOrEmpty(_appId)) return; // Skip: No Graph/AD Credentials
67+
if (string.IsNullOrEmpty(_appId)) Skip.Test("No Graph/AD Credentials");
6868

6969
var stream = new MemoryStream();
7070
var sw = new StreamWriter(stream);
@@ -94,7 +94,7 @@ public async Task CanSendEmailWithAttachments()
9494
[Test]
9595
public async Task CanSendHighPriorityEmail()
9696
{
97-
if (string.IsNullOrEmpty(_appId)) return; // Skip: No Graph/AD Credentials
97+
if (string.IsNullOrEmpty(_appId)) Skip.Test("No Graph/AD Credentials");
9898

9999
var email = Email
100100
.From(_senderEmail)

test/FluentEmail.Core.Tests/ThirdParty/MailgunSenderTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public MailgunSenderTests()
2828
[Test]
2929
public async Task CanSendEmail()
3030
{
31-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Mailgun Credentials
31+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Mailgun Credentials");
3232

3333
var email = Email
3434
.From(_fromEmail)
@@ -45,7 +45,7 @@ public async Task CanSendEmail()
4545
[Test]
4646
public async Task GetMessageIdInResponse()
4747
{
48-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Mailgun Credentials
48+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Mailgun Credentials");
4949

5050
var email = Email
5151
.From(_fromEmail)
@@ -63,7 +63,7 @@ public async Task GetMessageIdInResponse()
6363
[Test]
6464
public async Task CanSendEmailWithTag()
6565
{
66-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Mailgun Credentials
66+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Mailgun Credentials");
6767

6868
var email = Email
6969
.From(_fromEmail)
@@ -81,7 +81,7 @@ public async Task CanSendEmailWithTag()
8181
[Test]
8282
public async Task CanSendEmailWithVariables()
8383
{
84-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Mailgun Credentials
84+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Mailgun Credentials");
8585

8686
var email = Email
8787
.From(_fromEmail)
@@ -99,7 +99,7 @@ public async Task CanSendEmailWithVariables()
9999
[Test]
100100
public async Task CanSendEmailWithAttachments()
101101
{
102-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Mailgun Credentials
102+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Mailgun Credentials");
103103

104104
var stream = new MemoryStream();
105105
var sw = new StreamWriter(stream);
@@ -130,7 +130,7 @@ public async Task CanSendEmailWithAttachments()
130130
[Test]
131131
public async Task CanSendEmailWithInlineImages()
132132
{
133-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Mailgun Credentials
133+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Mailgun Credentials");
134134

135135
using (var stream = File.OpenRead($"{Path.Combine(Directory.GetCurrentDirectory(), "logotest.png")}"))
136136
{
@@ -160,8 +160,8 @@ public async Task CanSendEmailWithInlineImages()
160160
[Test]
161161
public async Task CanSendEmailWithTemplate()
162162
{
163-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Mailgun Credentials
164-
if (string.IsNullOrEmpty(Credentials.Mailgun.Template)) return; // Skip: No Mailgun Template
163+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Mailgun Credentials");
164+
if (string.IsNullOrEmpty(Credentials.Mailgun.Template)) Skip.Test("No Mailgun Template");
165165

166166
var email = Email
167167
.From(_fromEmail)

test/FluentEmail.Core.Tests/ThirdParty/MailtrapSenderTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public MailtrapSenderTests()
3333
[Test]
3434
public void CanSendEmail()
3535
{
36-
if (string.IsNullOrEmpty(_password)) return; // Skip: No Mailtrap Credentials
36+
if (string.IsNullOrEmpty(_password)) Skip.Test("No Mailtrap Credentials");
3737

3838
var email = Email
3939
.From(_fromEmail)
@@ -51,7 +51,7 @@ public void CanSendEmail()
5151
[Test]
5252
public async Task CanSendEmailAsync()
5353
{
54-
if (string.IsNullOrEmpty(_password)) return; // Skip: No Mailtrap Credentials
54+
if (string.IsNullOrEmpty(_password)) Skip.Test("No Mailtrap Credentials");
5555

5656
var email = Email
5757
.From(_fromEmail)
@@ -68,7 +68,7 @@ public async Task CanSendEmailAsync()
6868
[Test]
6969
public async Task CanSendEmailWithAttachments()
7070
{
71-
if (string.IsNullOrEmpty(_password)) return; // Skip: No Mailtrap Credentials
71+
if (string.IsNullOrEmpty(_password)) Skip.Test("No Mailtrap Credentials");
7272

7373
var stream = new MemoryStream();
7474
var sw = new StreamWriter(stream);
@@ -99,7 +99,7 @@ public async Task CanSendEmailWithAttachments()
9999
[Test]
100100
public async Task CanSendEmailWithInlineImages()
101101
{
102-
if (string.IsNullOrEmpty(_password)) return; // Skip: No Mailtrap Credentials
102+
if (string.IsNullOrEmpty(_password)) Skip.Test("No Mailtrap Credentials");
103103

104104
using (var stream = File.OpenRead($"{Path.Combine(Directory.GetCurrentDirectory(), "logotest.png")}"))
105105
{
@@ -129,7 +129,7 @@ public async Task CanSendEmailWithInlineImages()
129129
[Test]
130130
public async Task CanSendEmailWithTemplate()
131131
{
132-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Mailtrap Credentials
132+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Mailtrap Credentials");
133133

134134
var email = Email.From(_fromEmail).To(_toEmail);
135135
email.Sender = new MailtrapSender(_username, _apiKey, _host, 587, _apiHost);

test/FluentEmail.Core.Tests/ThirdParty/PostmarkSenderTests.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public PostmarkSenderTests()
3131
[Test]
3232
public void SimpleMailFromCodeSync()
3333
{
34-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
34+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
3535

3636
var email = Email
3737
.From(_fromEmail, FromName)
@@ -49,7 +49,7 @@ public void SimpleMailFromCodeSync()
4949
[Test]
5050
public async Task SimpleMailFromCode()
5151
{
52-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
52+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
5353

5454
Email.DefaultSender = new PostmarkSender(_apiKey);
5555

@@ -71,7 +71,7 @@ public async Task SimpleMailFromCode()
7171
[Test]
7272
public async Task SimpleMailFromCodeWithAddressesWithPlus()
7373
{
74-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
74+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
7575

7676
var email = Email
7777
.From(_fromEmailHash)
@@ -91,7 +91,7 @@ public async Task SimpleMailFromCodeWithAddressesWithPlus()
9191
[Test]
9292
public async Task SimpleMailReplyTo()
9393
{
94-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
94+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
9595

9696
var email = Email
9797
.From(_fromEmail)
@@ -111,7 +111,7 @@ public async Task SimpleMailReplyTo()
111111
[Test]
112112
public async Task SimpleMailWithNameFromCode()
113113
{
114-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
114+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
115115

116116
var email = Email
117117
.From(_fromEmail, FromName)
@@ -130,7 +130,7 @@ public async Task SimpleMailWithNameFromCode()
130130
[Test]
131131
public async Task SimpleHtmlMailFromCode()
132132
{
133-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
133+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
134134

135135
Email.DefaultSender = new PostmarkSender(_apiKey);
136136

@@ -149,7 +149,7 @@ public async Task SimpleHtmlMailFromCode()
149149
[Test]
150150
public async Task SimpleMailWithAttachmentFromCode()
151151
{
152-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
152+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
153153

154154
Email.DefaultSender = new PostmarkSender(_apiKey);
155155

@@ -176,7 +176,7 @@ public async Task SimpleMailWithAttachmentFromCode()
176176
[Test]
177177
public async Task SimpleHtmlMailWithAlternateFromCode()
178178
{
179-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
179+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
180180

181181
Email.DefaultSender = new PostmarkSender(_apiKey);
182182

@@ -196,7 +196,7 @@ public async Task SimpleHtmlMailWithAlternateFromCode()
196196
[Test]
197197
public async Task SimpleMailFromCodeWithOpts()
198198
{
199-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
199+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
200200

201201
var opts = new PostmarkSenderOptions(_apiKey)
202202
{
@@ -222,7 +222,7 @@ public async Task SimpleMailFromCodeWithOpts()
222222
[Test]
223223
public async Task SimpleMailFromCodeWithLowPrio()
224224
{
225-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
225+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
226226

227227
var email = Email
228228
.From(_fromEmail, FromName)
@@ -240,7 +240,7 @@ public async Task SimpleMailFromCodeWithLowPrio()
240240
[Test]
241241
public async Task SimpleMailFromCodeWithHighPrio()
242242
{
243-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
243+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
244244

245245
var email = Email
246246
.From(_fromEmail, FromName)
@@ -258,7 +258,7 @@ public async Task SimpleMailFromCodeWithHighPrio()
258258
[Test]
259259
public async Task SimpleMailFromCodeWithHeaders()
260260
{
261-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
261+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
262262

263263
var email = Email
264264
.From(_fromEmail, FromName)
@@ -277,31 +277,31 @@ public async Task SimpleMailFromCodeWithHeaders()
277277
[Test]
278278
public void SenderNullServerToken()
279279
{
280-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
280+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
281281
Func<PostmarkSender> fn = () => new PostmarkSender((string)null!);
282282
fn.Should().Throw<ArgumentNullException>();
283283
}
284284

285285
[Test]
286286
public void OptionsNullServerToken()
287287
{
288-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
288+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
289289
Func<PostmarkSenderOptions> fn = () => new PostmarkSenderOptions(null!);
290290
fn.Should().Throw<ArgumentNullException>();
291291
}
292292

293293
[Test]
294294
public void NullOptions()
295295
{
296-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
296+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
297297
Func<PostmarkSender> fn = () => new PostmarkSender((PostmarkSenderOptions)null!);
298298
fn.Should().Throw<ArgumentNullException>();
299299
}
300300

301301
[Test]
302302
public void SendNull()
303303
{
304-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
304+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
305305
var sender = new PostmarkSender(_apiKey);
306306
Func<Task> fn = async () => await sender.SendAsync(null!).ConfigureAwait(false);
307307
fn.Should().ThrowAsync<ArgumentNullException>();
@@ -310,7 +310,7 @@ public void SendNull()
310310
[Test]
311311
public async Task TooManyRecipients()
312312
{
313-
if (string.IsNullOrEmpty(_apiKey)) return; // Skip: No Postmark Credentials
313+
if (string.IsNullOrEmpty(_apiKey)) Skip.Test("No Postmark Credentials");
314314

315315
var email = Email
316316
.From(_fromEmail, FromName)

0 commit comments

Comments
 (0)