question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EventDataBatch is not mockable

See original GitHub issue

I’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:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
pakrymcommented, Nov 2, 2020

You are right. It’s only the case of an absent event enumerator

0reactions
jsquirecommented, Nov 2, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found