elastic/elasticsearch-net

Cannot mock bulk reponse items anymore

Closed this issue · 1 comments

9.0.7:

9.0.4:

8:

Mocking bulk indexing responses for unit tests is no longer possible:

The class definition of BulkIndexResponseItem changed from having no explicit constructors in 8.x to having a single explicit internally scoped constructor. This prevents us from writing unit tests, as there is no publicly accessible constructor
public sealed class BulkIndexResponseItem : ResponseItem { public override string Operation => "index"; //Prevents public constructor from being created. [SetsRequiredMembers] internal BulkIndexResponseItem(JsonConstructorSentinel sentinel) : base(sentinel) { } }

Expected behavior
Provide a parameterless constructor for supporting unit tests.

Found workaround, closing issue