azure-sdk-for-net
azure-sdk-for-net copied to clipboard
Samples for Mocking Client Types
Summary
The Event Hubs client library aims to be mockable and fully support testability. To help illustrate usage of the new API for the testing scenarios, a set of samples mocking the various Event Hubs client types and illustrating use of the model factory is needed.
Scope of Work
-
Implement a sample or set of samples demonstrating a basic approach for mocking the high level client types for their core scenarios. Included should be:
EventHubProducerClientEventHubConsumerClientEventProcessorClientPartitionReceiverEventProcessor<TPartition>
-
Ensure that the use of the model factory is demonstrated for key types, including:
EventDataEventDataBatchEventHubPropertiesPartitionPropertiesPartitionPublishingPropertiesLastEnqueuedEventPropertiesPartitionContext
Success Criteria
-
The sample(s) have been created, with a clear and simple approach and detailed discussion to support the goal of helping those unfamiliar with Event Hubs to get started testing its types.
-
The sample(s) adhere to the coding conventions and standards defined for track two libraries.
-
All projects in the solution compile; any warnings that exist have either been fixed or additional work items filed to address them if they were deemed non-critical.
-
The sample(s) follow the pattern within the Event Hubs library, are compiled and executed as part of the Live test suite.
Related
The following are promising pull requests begun by a community member before they were unable to complete due to time constraints. These would serve as a great starting point.
- Samples for Mocking Client Types (EventProcessor)
- Samples for Mocking Client Types (EventHubProducerClient)
References
Hi @jsquire, If this is still open, I'd like to take this up.
Hi @ACHYUT001. Apologies for missing the notification on this earlier. Your contribution would be greatly appreciated. Our goal here would be to demonstrate the types mentioned in the scope, and I think the best way to do that would be to try and mirror some of the core scenarios that we demonstrate in our publishing, consuming, and processing samples.
As you may already be aware, our samples are markdown-based and with the code driven from snippets defined in our test suite. I added a few more references to the issue description that may help you get started. Since this work is based around unit testing, we can probably avoid Live tests and just stick with unit tests - like the first set of snippets above.
I'm happy to help you along as best I can; please feel free to use a draft PR to share ideas and start discussion, just mention me when you'd like my thoughts. Thank you for helping to make the Azure SDK experience better!
Hi @jsquire ,
Sorry, been a little away past few days. I'll pick this up and have a draft PR done by EoW.
Thanks
Hi @jsquire ,
I've started out writing the mocks. Here are a few for Publishing, requesting your thoughts : PR21630 Should I cover all the scenarios as done in the publishing sample?
I also needed your assistance in understanding the points to cover in the markdown file of the sample.
Thanks
Should this issue still have the status of Open?
Yes, this work has not been completed. There have been some contributions that formed a good foundation for the samples, but there is still some work needed to complete the sample.