-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add link to package in Contact Owners email (#5202)
- Loading branch information
Scott Bommarito
authored
Dec 19, 2017
1 parent
f7917ff
commit 8f74b0b
Showing
5 changed files
with
38 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,7 +208,7 @@ public void WillCopySenderIfAsked() | |
}; | ||
var messageService = TestableMessageService.Create(GetConfigurationService()); | ||
|
||
messageService.SendContactOwnersMessage(from, package, "Test message", "http://someurl/", true); | ||
messageService.SendContactOwnersMessage(from, package, "http://someurl/", "Test message", "http://someotherurl/", true); | ||
|
||
var messages = messageService.MockMailSender.Sent; | ||
Assert.Equal(2, messages.Count); | ||
|
@@ -226,30 +226,37 @@ public void WillCopySenderIfAsked() | |
[Fact] | ||
public void WillSendEmailToAllOwners() | ||
{ | ||
var from = new MailAddress("[email protected]", "flossy"); | ||
var id = "smangit"; | ||
var owner1Email = "[email protected]"; | ||
var owner2Email = "[email protected]"; | ||
var userUsername = "flossy"; | ||
var userEmail = "[email protected]"; | ||
var from = new MailAddress(userEmail, userUsername); | ||
var package = new PackageRegistration | ||
{ | ||
Id = "smangit", | ||
Id = id, | ||
Owners = new[] | ||
{ | ||
new User { EmailAddress = "[email protected]", EmailAllowed = true }, | ||
new User { EmailAddress = "[email protected]", EmailAllowed = true } | ||
new User { EmailAddress = owner1Email, EmailAllowed = true }, | ||
new User { EmailAddress = owner2Email, EmailAllowed = true } | ||
} | ||
}; | ||
|
||
var messageService = TestableMessageService.Create(GetConfigurationService()); | ||
|
||
messageService.SendContactOwnersMessage(from, package, "Test message", "http://someurl/", false); | ||
var packageUrl = "http://packageUrl/"; | ||
messageService.SendContactOwnersMessage(from, package, packageUrl, "Test message", "http://emailSettingsUrl/", false); | ||
var message = messageService.MockMailSender.Sent.Last(); | ||
|
||
Assert.Equal("[email protected]", message.To[0].Address); | ||
Assert.Equal("[email protected]", message.To[1].Address); | ||
Assert.Equal(owner1Email, message.To[0].Address); | ||
Assert.Equal(owner2Email, message.To[1].Address); | ||
Assert.Equal(TestGalleryOwner, message.From); | ||
Assert.Equal("[email protected]", message.ReplyToList.Single().Address); | ||
Assert.Contains("[Joe Shmoe] Message for owners of the package 'smangit'", message.Subject); | ||
Assert.Equal(userEmail, message.ReplyToList.Single().Address); | ||
Assert.Contains($"[Joe Shmoe] Message for owners of the package '{id}'", message.Subject); | ||
Assert.Contains("Test message", message.Body); | ||
Assert.Contains( | ||
"User flossy <[email protected]> sends the following message to the owners of Package 'smangit'.", message.Body); | ||
$"User {userUsername} <{userEmail}> sends the following message to the owners of Package '[{id}]({packageUrl})'.", | ||
message.Body); | ||
} | ||
|
||
[Fact] | ||
|
@@ -268,7 +275,7 @@ public void WillNotSendEmailToOwnerThatOptsOut() | |
|
||
var messageService = TestableMessageService.Create(GetConfigurationService()); | ||
|
||
messageService.SendContactOwnersMessage(from, package, "Test message", "http://someurl/", false); | ||
messageService.SendContactOwnersMessage(from, package, "http://someurl/", "Test message", "http://someotherurl/", false); | ||
var message = messageService.MockMailSender.Sent.Last(); | ||
|
||
Assert.Equal("[email protected]", message.To[0].Address); | ||
|
@@ -290,7 +297,7 @@ public void WillNotAttemptToSendIfNoOwnersAllow() | |
}; | ||
|
||
var messageService = TestableMessageService.Create(GetConfigurationService()); | ||
messageService.SendContactOwnersMessage(from, package, "Test message", "http://someurl/", false); | ||
messageService.SendContactOwnersMessage(from, package, "http://someurl/", "Test message", "http://someotherurl/", false); | ||
|
||
Assert.Empty(messageService.MockMailSender.Sent); | ||
} | ||
|
@@ -307,7 +314,7 @@ public void WillNotCopySenderIfNoOwnersAllow() | |
}; | ||
|
||
var messageService = TestableMessageService.Create(GetConfigurationService()); | ||
messageService.SendContactOwnersMessage(from, package, "Test message", "http://someurl/", false); | ||
messageService.SendContactOwnersMessage(from, package, "http://someurl/", "Test message", "http://someotherurl/", false); | ||
|
||
Assert.Empty(messageService.MockMailSender.Sent); | ||
} | ||
|