Skip to content

Unit Testing beef up #7727

Open
Open
@RejectKid

Description

@RejectKid

I have noticed the new ESClient is a bit hard to unit test. I understand that not all features are in the new 8.x.x versions but it's seeming very difficult to test given the accessibility of things (unless im dumb, which is possible)

var resourcesFromElastic = await elasticSearchClient.Value.SearchAsync<Source>(searchRequest.Value);

if i try to mock the response using the TestableResponseFactory I dont see an easy way to create mock data to return.

var expectedSearchResponse = new SearchResponse<Source>() { HitsMetadata = new HitsMetadata<Source>() { Hits = new List<Hit<Source>>() { new(), new() } } };

this was the best i got so far, but I'd rather fill it in with data (my Source object) and I cant due to Hit, is there a way to handle this? or is this coming in the future

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions