Skip to content

Add test coverage for UseScheduledTasks capability registration#505

Closed
Copilot wants to merge 2 commits intowangbill/logwokfrom
copilot/sub-pr-502-again
Closed

Add test coverage for UseScheduledTasks capability registration#505
Copilot wants to merge 2 commits intowangbill/logwokfrom
copilot/sub-pr-502-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 14, 2025

The UseScheduledTasks() extension method lacked test coverage to verify it correctly registers the WorkerCapability.ScheduledTasks capability with GrpcDurableTaskWorkerOptions.

Changes

  • New test file: test/ScheduledTasks.Tests/Extension/DurableTaskWorkerBuilderExtensionsTests.cs

    • Verifies capability is added to default options
    • Verifies capability is added to named options
  • Updated: test/ScheduledTasks.Tests/ScheduledTasks.Tests.csproj

    • Added Microsoft.Extensions.DependencyInjection dependency

Test approach

[Fact]
public void UseScheduledTasks_AddsScheduledTasksCapability()
{
    ServiceCollection services = new();
    Mock<IDurableTaskWorkerBuilder> mockBuilder = new();
    mockBuilder.Setup(b => b.Services).Returns(services);
    
    mockBuilder.Object.UseScheduledTasks();
    
    ServiceProvider provider = services.BuildServiceProvider();
    var options = provider.GetRequiredService<IOptions<GrpcDurableTaskWorkerOptions>>();
    options.Value.Capabilities.Should().Contain(P.WorkerCapability.ScheduledTasks);
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 14, 2025

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:

  • aka.ms
    • Triggering command: curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED (dns block)

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

Copilot AI changed the title [WIP] Work in progress on support worker features feedback Add test coverage for UseScheduledTasks capability registration Nov 14, 2025
Copilot AI requested a review from YunchuWang November 14, 2025 22:33
@YunchuWang YunchuWang marked this pull request as ready for review November 14, 2025 22:34
@YunchuWang YunchuWang closed this Nov 14, 2025
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.

2 participants