Skip to content

Commit

Permalink
Merge branch 'release/0.81.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed May 9, 2021
2 parents 4179dd1 + c8684e8 commit 1734e65
Show file tree
Hide file tree
Showing 22 changed files with 701 additions and 966 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ _TeamCity*
!.axoCover/settings.json

# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
coverage*.[ji][sn][of][no]
coverage*.xml

# Visual Studio code coverage results
*.coverage
Expand Down
20 changes: 1 addition & 19 deletions Source/StrongGrid.IntegrationTests/Tests/Mail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,7 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken
};
var mailSettings = new MailSettings
{
SandboxMode = new SandboxModeSettings
{
Enabled = true
},
Bcc = new BccSettings
{
Enabled = true,
EmailAddress = "[email protected]"
},
BypassListManagement = new BypassListManagementSettings
{
Enabled = false
},
SpamChecking = new SpamCheckingSettings
{
Enabled = false,
Threshold = 1,
PostToUrl = "http://whatever.com"
},
SandboxModeEnabled = true,
Footer = new FooterSettings
{
Enabled = true,
Expand Down
22 changes: 22 additions & 0 deletions Source/StrongGrid.IntegrationTests/Tests/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,28 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken
await log.WriteLineAsync($" - {mailSetting.Title}: {(mailSetting.Enabled ? "Enabled" : "Not enabled")}").ConfigureAwait(false);
}

var spamCheckSettings = await client.Settings.GetSpamCheckMailSettingsAsync(null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("SPAM Check settings retrieved:").ConfigureAwait(false);
await log.WriteLineAsync($" - Enabled: {spamCheckSettings.Enabled}").ConfigureAwait(false);
await log.WriteLineAsync($" - Threshold: {spamCheckSettings.Threshold}").ConfigureAwait(false);
await log.WriteLineAsync($" - URL: {spamCheckSettings.Url}").ConfigureAwait(false);

var updatedSpamCheckSettings = await client.Settings.UpdateSpamCheckMailSettingsAsync(false, null, 1, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("SPAM Check settings updated:").ConfigureAwait(false);
await log.WriteLineAsync($" - Enabled: {updatedSpamCheckSettings.Enabled}").ConfigureAwait(false);
await log.WriteLineAsync($" - Threshold: {updatedSpamCheckSettings.Threshold}").ConfigureAwait(false);
await log.WriteLineAsync($" - URL: {updatedSpamCheckSettings.Url}").ConfigureAwait(false);

var bccSettings = await client.Settings.GetBccMailSettingsAsync(null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("BCC settings retrieved:").ConfigureAwait(false);
await log.WriteLineAsync($" - Enabled: {bccSettings.Enabled}").ConfigureAwait(false);
await log.WriteLineAsync($" - Address: {bccSettings.EmailAddress}").ConfigureAwait(false);

var updatedBccSettings = await client.Settings.UpdateBccMailSettingsAsync(false, null, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("BCC settings updated:").ConfigureAwait(false);
await log.WriteLineAsync($" - Enabled: {updatedBccSettings.Enabled}").ConfigureAwait(false);
await log.WriteLineAsync($" - Address: {updatedBccSettings.EmailAddress}").ConfigureAwait(false);

var clickTrackingSettings = await client.Settings.GetClickTrackingSettingsAsync(null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("Click tracking settings retrieved:").ConfigureAwait(false);
await log.WriteLineAsync($" - Enabled in text content: {clickTrackingSettings.EnabledInTextContent}").ConfigureAwait(false);
Expand Down
21 changes: 18 additions & 3 deletions Source/StrongGrid.UnitTests/Resources/MailTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,23 @@ public async Task SendAsync()
}
};

var mailSettings = new MailSettings()
{
BypassBounceManagement = true,
BypassListManagement = true,
BypassSpamManagement = true,
BypassUnsubscribeManagement = true,
SandboxModeEnabled = true,
Footer = new FooterSettings()
{
Enabled = true,
HtmlContent = "abc123",
TextContent = "yzx890"
}
};

// Act
var result = await mail.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);
var result = await mail.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, mailSettings, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);

// Assert
mockHttp.VerifyNoOutstandingExpectation();
Expand Down Expand Up @@ -74,7 +89,7 @@ public async Task SendAsync_response_with_message_id()
};

// Act
var result = await mail.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);
var result = await mail.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);

// Assert
mockHttp.VerifyNoOutstandingExpectation();
Expand Down Expand Up @@ -107,7 +122,7 @@ public async Task SendAsync_request_with_bcc_only()
};

// Act
var result = await mail.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);
var result = await mail.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);

// Assert
mockHttp.VerifyNoOutstandingExpectation();
Expand Down
24 changes: 12 additions & 12 deletions Source/StrongGrid.UnitTests/Warmup/WarmupEngineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public async Task SendToSingleRecipientAsync_first_email_sent_on_first_day()

var mockMailResource = new Mock<IMail>(MockBehavior.Strict);
mockMailResource
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.ReturnsAsync("message_id_on_pool");

var mockClient = new Mock<IBaseClient>(MockBehavior.Strict);
Expand Down Expand Up @@ -116,7 +116,7 @@ public async Task SendToSingleRecipientAsync_first_email_sent_on_first_day()
var warmupEngine = new WarmupEngine(warmupSettings, mockClient.Object, mockRepository.Object, mockSystemClock.Object);

// Act
var result = await warmupEngine.SendToSingleRecipientAsync(recipient, null, null, null, null, null, null, false, false, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);
var result = await warmupEngine.SendToSingleRecipientAsync(recipient, null, null, null, null, null, null, false, false, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);

// Assert
mockClient.VerifyAll();
Expand Down Expand Up @@ -152,10 +152,10 @@ public async Task SendAsync_exceeding_daily_volume()

var mockMailResource = new Mock<IMail>(MockBehavior.Strict);
mockMailResource
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1 && p[0].To[0].Email == "[email protected]"), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1 && p[0].To[0].Email == "[email protected]"), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.ReturnsAsync("message_id_on_pool");
mockMailResource
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1 && p[0].To[0].Email == "[email protected]"), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1 && p[0].To[0].Email == "[email protected]"), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.ReturnsAsync("message_id_not_on_pool");

var mockClient = new Mock<IBaseClient>(MockBehavior.Strict);
Expand Down Expand Up @@ -186,7 +186,7 @@ public async Task SendAsync_exceeding_daily_volume()
var warmupEngine = new WarmupEngine(warmupSettings, mockClient.Object, mockRepository.Object, mockSystemClock.Object);

// Act
var result = await warmupEngine.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);
var result = await warmupEngine.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);

// Assert
mockClient.VerifyAll();
Expand Down Expand Up @@ -222,7 +222,7 @@ public async Task SendAsync_next_day_within_resetDays()

var mockMailResource = new Mock<IMail>(MockBehavior.Strict);
mockMailResource
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 2), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 2), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.ReturnsAsync("message_id_on_pool");

var mockClient = new Mock<IBaseClient>(MockBehavior.Strict);
Expand Down Expand Up @@ -253,7 +253,7 @@ public async Task SendAsync_next_day_within_resetDays()
var warmupEngine = new WarmupEngine(warmupSettings, mockClient.Object, mockRepository.Object, mockSystemClock.Object);

// Act
var result = await warmupEngine.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);
var result = await warmupEngine.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);

// Assert
mockClient.VerifyAll();
Expand Down Expand Up @@ -289,7 +289,7 @@ public async Task SendAsync_next_day_past_resetDays()

var mockMailResource = new Mock<IMail>(MockBehavior.Strict);
mockMailResource
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 2), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 2), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.ReturnsAsync("message_id_on_pool");

var mockClient = new Mock<IBaseClient>(MockBehavior.Strict);
Expand Down Expand Up @@ -320,7 +320,7 @@ public async Task SendAsync_next_day_past_resetDays()
var warmupEngine = new WarmupEngine(warmupSettings, mockClient.Object, mockRepository.Object, mockSystemClock.Object);

// Act
var result = await warmupEngine.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);
var result = await warmupEngine.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);

// Assert
mockClient.VerifyAll();
Expand Down Expand Up @@ -361,10 +361,10 @@ public async Task SendAsync_last_day_exceeding_daily_volume()

var mockMailResource = new Mock<IMail>(MockBehavior.Strict);
mockMailResource
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1 && p[0].To[0].Email == "[email protected]"), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1 && p[0].To[0].Email == "[email protected]"), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.ReturnsAsync("message_id_on_pool");
mockMailResource
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1 && p[0].To[0].Email == "[email protected]"), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.Setup(r => r.SendAsync(It.Is<MailPersonalization[]>(p => p.Length == 1 && p[0].To[0].Email == "[email protected]"), It.IsAny<string>(), It.IsAny<IEnumerable<MailContent>>(), It.IsAny<MailAddress>(), It.IsAny<MailAddress>(), It.IsAny<IEnumerable<Attachment>>(), It.IsAny<string>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<IEnumerable<KeyValuePair<string, string>>>(), It.IsAny<DateTime?>(), It.IsAny<string>(), It.IsAny<UnsubscribeOptions>(), It.IsAny<string>(), It.IsAny<MailSettings>(), It.IsAny<TrackingSettings>(), It.IsAny<MailPriority>(), It.IsAny<CancellationToken>()))
.ReturnsAsync("message_id_not_on_pool");

var mockClient = new Mock<IBaseClient>(MockBehavior.Strict);
Expand Down Expand Up @@ -396,7 +396,7 @@ public async Task SendAsync_last_day_exceeding_daily_volume()
var warmupEngine = new WarmupEngine(warmupSettings, mockClient.Object, mockRepository.Object, mockSystemClock.Object);

// Act
var result = await warmupEngine.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);
var result = await warmupEngine.SendAsync(personalizations, null, null, null, null, null, null, null, null, null, null, null, null, null, null, MailPriority.Normal, CancellationToken.None).ConfigureAwait(false);

// Assert
mockClient.VerifyAll();
Expand Down
Loading

0 comments on commit 1734e65

Please sign in to comment.