Skip to content

Add injectable SES email service and integration coverage for moderator/subscriber send paths#508

Open
Copilot wants to merge 8 commits into
mainfrom
copilot/add-integration-tests-send-email
Open

Add injectable SES email service and integration coverage for moderator/subscriber send paths#508
Copilot wants to merge 8 commits into
mainfrom
copilot/add-integration-tests-send-email

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

  • Analyze review comment about ProcessDocumentsAsync returning Task<bool> when it always returns true
  • Change ProcessDocumentsAsync to return Task in SendModeratorEmail.cs
  • Update integration tests to not capture or assert on the bool return value
  • Run tests to validate (all relevant tests pass)

Copilot AI changed the title [WIP] Add integration tests for SendModeratorEmail and SendSubscriberEmail Add injectable SES email service and integration coverage for moderator/subscriber send paths May 25, 2026
Copilot AI requested a review from dthaler May 25, 2026 13:59
@dthaler dthaler marked this pull request as ready for review May 25, 2026 14:18
@dthaler dthaler requested a review from Copilot May 25, 2026 14:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an injectable email-sending abstraction to the NotificationSystem Azure Functions so SES email delivery can be mocked in tests, and introduces new integration tests covering the moderator and subscriber email send flows.

Changes:

  • Introduce IEmailService and an SES-backed implementation AwsEmailService.
  • Refactor SendModeratorEmail and SendSubscriberEmail to accept IEmailService and expose testable processing methods.
  • Add integration tests that validate email requests via a mocked IEmailService.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
NotificationSystem/NotificationSystem/Utilities/IEmailService.cs Adds an email service interface to decouple functions from SES client usage.
NotificationSystem/NotificationSystem/Utilities/AwsEmailService.cs Implements the interface using AmazonSimpleEmailServiceClient.
NotificationSystem/NotificationSystem/SendSubscriberEmail.cs Injects IEmailService and extracts message processing into ProcessMessagesAsync.
NotificationSystem/NotificationSystem/SendModeratorEmail.cs Injects IEmailService, adds ProcessDocumentsAsync, and introduces a pre-check for unreviewed docs.
NotificationSystem/NotificationSystem/Program.cs Wires up DI registration for IEmailService -> AwsEmailService.
NotificationSystem/NotificationSystem.Tests.Integration/SendSubscriberEmailIntegrationTests.cs Adds mocked-email integration coverage for subscriber send behavior.
NotificationSystem/NotificationSystem.Tests.Integration/SendModeratorEmailIntegrationTests.cs Adds mocked-email integration coverage for moderator send/skip behavior.

Comment thread NotificationSystem/NotificationSystem/SendModeratorEmail.cs
Comment thread NotificationSystem/NotificationSystem/Utilities/AwsEmailService.cs Outdated
dthaler and others added 2 commits May 25, 2026 10:27
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 25, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • audio-orcasound-net.s3.us-west-2.amazonaws.com
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 45913 --endpoint 127.0.0.1:045913 --role client --parentprocessid 4251 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 39967 --endpoint 127.0.0.1:039967 --role client --parentprocessid 4360 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 33073 --endpoint 127.0.0.1:033073 --role client --parentprocessid 4472 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 25, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • audio-orcasound-net.s3.us-west-2.amazonaws.com
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 36487 --endpoint 127.0.0.1:036487 --role client --parentprocessid 4294 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 35273 --endpoint 127.0.0.1:035273 --role client --parentprocessid 4401 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 37553 --endpoint 127.0.0.1:037553 --role client --parentprocessid 4538 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 25, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • audio-orcasound-net.s3.us-west-2.amazonaws.com
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 40177 --endpoint 127.0.0.1:040177 --role client --parentprocessid 4256 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 37471 --endpoint 127.0.0.1:037471 --role client --parentprocessid 4363 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 32867 --endpoint 127.0.0.1:032867 --role client --parentprocessid 4501 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@dthaler dthaler requested a review from Copilot May 25, 2026 14:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

NotificationSystem/NotificationSystem.Tests.Integration/SendModeratorEmailIntegrationTests.cs:78

  • Same as above: this test mutates the global "SenderEmail" environment variable without resetting it afterward, which can leak state into other tests. Please restore the previous value in a finally block (or otherwise isolate the environment) to avoid cross-test interference.
            Environment.SetEnvironmentVariable("SenderEmail", "sender@example.com");
            var emailServiceMock = new Mock<IEmailService>();
            emailServiceMock.Setup(x => x.SendEmailAsync(It.IsAny<SendEmailRequest>()))
                .Returns(Task.CompletedTask);

Comment thread NotificationSystem/NotificationSystem/SendModeratorEmail.cs Outdated
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 25, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • audio-orcasound-net.s3.us-west-2.amazonaws.com
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 46187 --endpoint 127.0.0.1:046187 --role client --parentprocessid 4273 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 41439 --endpoint 127.0.0.1:041439 --role client --parentprocessid 4387 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.runtimeconfig.json --depsfile /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/NotificationSystem.Tests.Integration.deps.json /home/REDACTED/work/orcahello/orcahello/NotificationSystem/NotificationSystem.Tests.Integration/bin/Debug/net8.0/testhost.dll --port 44629 --endpoint 127.0.0.1:044629 --role client --parentprocessid 4520 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add integration tests for Send{Moderator,Subscriber}Email.cs

3 participants