# How to mock Elasticsearch ExistsAsync response

**URL:** <https://discuss.elastic.co/t/how-to-mock-elasticsearch-existsasync-response/371935>\
**Category:** Elasticsearch\
**Created:** [December 12, 2024, 8:46pm UTC](https://discuss.elastic.co/t/how-to-mock-elasticsearch-existsasync-response/371935 "2024-12-12T20:46:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![flobernd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flobernd/32/124877_2.png) [@flobernd](https://discuss.elastic.co/u/flobernd)\
**Post date:** [December 13, 2024, 8:51am UTC](https://discuss.elastic.co/t/how-to-mock-elasticsearch-existsasync-response/371935/2 "2024-12-13T08:51:39Z")

</div>

Hi @Guthula_Baladitya ,

please see my response here:

> [@Mocking the .NET Client for ExistsResponse in unit tests](https://discuss.elastic.co/t/mocking-the-net-client-for-existsresponse-in-unit-tests/371915):
>
> Hello Everyone, I am using .NET 8 and "Elastic.Clients.Elasticsearch" Version="8.15.6" (not NEST) For mocking we are using NSubstitute(not Moq) I tried to go through multiple blogs and even the github repo for .NET client tests but could not find anything concrete around how to mock the sealed class for exists response i.e. public sealed partial class ExistsResponse : ElasticsearchResponse We could successfully use it for SearchResponse and MappingResponse but could not make it work for Exis…

---

_[View the full topic](https://discuss.elastic.co/t/how-to-mock-elasticsearch-existsasync-response/371935)._
