EventDataBatch is not mockable
See original GitHub issueI’m trying to write a test for code that uses the EventHubProducerClient
and EventDataBatch
. The goal is to verify that the batch contains an expected set of events without running against the live service.
It’s possible to create a mock EventHubProducerClient but there is no way to create a mock EventDataBatch
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
How to Unit Test Azure EventHub with EventDataBatch and ...
I used to just mock the client and Stub out EventHubProducerClient's SendAsync capturing (actually i had a custom matcher, but effectively it's ...
Read more >EventHubsModelFactory Class (Azure.Messaging. ...
A factory for the creation of Event Hubs model types to assist with mocking and testing.
Read more >Class EventHubsModelFactory | Azure SDK for .NET
Initializes a new instance of the EventDataBatch(Int64, IList<EventData>, ... this is a static value and will not mutate as events are added. System....
Read more >Azure.Messaging.EventHubs.Processor 5.9.2
The data model types, such as EventData and EventDataBatch are not thread-safe. They should not be shared across threads nor used concurrently with...
Read more >How to mock Azure Event Hub in .Net NUnit tests
EventHubProducerClient provides a mock-friendly design as all its public members are virtual or settable. The class is not sealed and offers a parameterless ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You are right. It’s only the case of an absent event enumerator
This will be covered as part of #9117. The model factory will be including a mocked up transport batch and likely taking a list to use as a backing source so that developers can inspect what was accepted.
I’m going to close this out as a dupe.