azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

Samples for Mocking Client Types

Open jsquire opened this issue 6 years ago • 6 comments
trafficstars

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:

    • EventHubProducerClient
    • EventHubConsumerClient
    • EventProcessorClient
    • PartitionReceiver
    • EventProcessor<TPartition>

  • Ensure that the use of the model factory is demonstrated for key types, including:

    • EventData
    • EventDataBatch
    • EventHubProperties
    • PartitionProperties
    • PartitionPublishingProperties
    • LastEnqueuedEventProperties
    • PartitionContext

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.

References

jsquire avatar Aug 23 '19 16:08 jsquire

Hi @jsquire, If this is still open, I'd like to take this up.

ACHYUT001 avatar May 01 '21 15:05 ACHYUT001

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!

jsquire avatar May 10 '21 17:05 jsquire

Hi @jsquire ,

Sorry, been a little away past few days. I'll pick this up and have a draft PR done by EoW.

Thanks

ACHYUT001 avatar May 31 '21 16:05 ACHYUT001

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

ACHYUT001 avatar Jun 05 '21 13:06 ACHYUT001

Should this issue still have the status of Open?

samjones00 avatar Feb 11 '22 15:02 samjones00

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.

jsquire avatar Feb 11 '22 20:02 jsquire