Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Messaging] Advanced sample for mocking processor types #35696

Open
jsquire opened this issue Apr 20, 2023 · 0 comments
Open

[Messaging] Advanced sample for mocking processor types #35696

jsquire opened this issue Apr 20, 2023 · 0 comments
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs help wanted This issue is tracking work for which community contributions would be welcomed and appreciated Service Bus
Milestone

Comments

@jsquire
Copy link
Member

jsquire commented Apr 20, 2023

Summary

Unlike other client types in the Event Hubs and Service Bus client libraries, the processor types are not deeply integrated into the application code. Rather than the application invoking operations on the client and using the results, the processors work in a push-based model where application code is registered as a .NET event handler and the processor invokes it when data is available.

In mainstream scenarios for the processor, testing/mocking should be focused on the application-provided code in the event handlers and confirming that the processor is started/stopped as intended. This is where our samples are focused - trying to guide developers towards testing their application code directly rather than indirectly by asserting control over the processor infrastructure.

There are some minority scenarios for testing - such as an application validating that the correct handler has been assigned - that doesn't lend itself well to the mocking/testing guidance for the mainstream scenarios. Generally, these require use of a custom test shim that extends the processor type rather than a stub mock created by Moq or another testing library. While we certainly want to ensure that this style of tests are possible, they requires a non-trivial amount of complexity that isn't needed for the majority case.

It would be helpful to have some kind of documentation or sample that discusses creating a mock-by-extension but including it in our mainstream sample does not seem to be the right place for it. A different approach is needed, whether that be an "advanced mocking" sample or a stand-alone sample application.

Scope of Work

  • Collaborate to determine the form that this documentation/sample should take, considering both Event Hubs and for Service Bus processor types.

  • Implement the sample for the Event Hubs and Service Bus processor types.

Success Criteria

  • The sample(s) have been created, with a clear approach for using a mock-by-extension to simulate processor operation.

  • The sample(s) follow the patterns local to the Event Hubs or Service Bus library, even if they differ between them.

References and Resources

@jsquire jsquire added Service Bus Event Hubs Client This issue points to a problem in the data-plane of the library. help wanted This issue is tracking work for which community contributions would be welcomed and appreciated labels Apr 20, 2023
@jsquire jsquire added this to the Backlog milestone Apr 20, 2023
@jsquire jsquire moved this to Needs Costing in Azure SDK for Event Hubs Apr 20, 2023
@jsquire jsquire moved this to Needs Costing in Azure SDK for Service Bus Apr 20, 2023
@jsquire jsquire moved this from Needs Costing to Planned in Azure SDK for Event Hubs Jul 26, 2023
@jsquire jsquire moved this from Needs Costing to Planned in Azure SDK for Service Bus Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Event Hubs help wanted This issue is tracking work for which community contributions would be welcomed and appreciated Service Bus
Projects
Status: Planned
Status: Planned
Development

No branches or pull requests

1 participant