Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka client unit testing for dotnet

Im looking for assistance in writing unit tests for kafka in dotnet. Confluent seems to provide a Mocks for producers and consumers in Java only.

like image 450
ComeIn Avatar asked Oct 25 '25 11:10

ComeIn


1 Answers

Confluent uses Docker Compose to start actual brokers (at least for integration tests)

You may also look through the unit tests folder for their own code

https://github.com/confluentinc/confluent-kafka-dotnet/tree/master/test

They tried to use Moq mocking library against IProducer, but that code is commented - https://github.com/confluentinc/confluent-kafka-dotnet/blob/master/test/Confluent.Kafka.UnitTests/MoqExample.cs

like image 51
OneCricketeer Avatar answered Oct 28 '25 02:10

OneCricketeer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!