Skip to content

Commit

Permalink
Populate SendEmailResponse with email subject as result
Browse files Browse the repository at this point in the history
  • Loading branch information
Mai An Krause Bernt committed Aug 19, 2024
1 parent 9e98156 commit 42d1260
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/XrmMockupShared/Requests/SendEmailRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ internal override OrganizationResponse Execute(OrganizationRequest orgRequest, E

db.Update(email);

return new SendEmailResponse();
return new SendEmailResponse
{
Results = new ParameterCollection
{
{ "Subject", email.Contains("subject") ? email.GetAttributeValue<string>("subject") : null }
}
};
}
}
}
3 changes: 3 additions & 0 deletions tests/SharedTests/TestSendEmail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void TestSendEmailRequestSuccessWhenIssueSendTrue()

var response = orgAdminUIService.Execute(sendEmailRequest) as SendEmailResponse;
Assert.NotNull(response);
Assert.Equal(email.Subject, response.Subject);

using (var context = new Xrm(orgAdminUIService))
{
Expand Down Expand Up @@ -95,6 +96,7 @@ public void TestSendEmailRequestSuccessWhenIssueSendFalse()

var response = orgAdminUIService.Execute(sendEmailRequest) as SendEmailResponse;
Assert.NotNull(response);
Assert.Equal(email.Subject, response.Subject);

using (var context = new Xrm(orgAdminUIService))
{
Expand Down Expand Up @@ -135,6 +137,7 @@ public void TestSendEmailRequestSuccessWithUnresolvedRecipient()

var response = orgAdminUIService.Execute(sendEmailRequest) as SendEmailResponse;
Assert.NotNull(response);
Assert.Equal(email.Subject, response.Subject);

using (var context = new Xrm(orgAdminUIService))
{
Expand Down

0 comments on commit 42d1260

Please sign in to comment.