public void PASS_CreateRequest_Documents_IndexSpecified() { MultiGetRequestContent content = new MultiGetRequestContent( new List<MultiGetRequestedDocument>() { new MultiGetRequestedDocument(_Index, _Type, _Id) }); MultiGetDocumentRequest request = new MultiGetDocumentRequest(content); }
public MultiGetDocumentRequest(MultiGetRequestContent content, string index = null, string documentType = null) { if (content == null || content.IsNull) { throw new ArgumentNullException("content", "Multi Get Request requires either the documents or documentids property in MultiGetContent to be populated."); } if (content.Documents != null && content.Documents.Any()) { if (!content.AllIndexesSpecifiedInDocuments && !content.NoIndexesSpecifiedInDocuments) { throw new ArgumentNullException("index", "Either all MultiGetRequestedDocuments must have their index value populated or none may have their index populated."); } else if (content.NoIndexesSpecifiedInDocuments && string.IsNullOrWhiteSpace(index)) { throw new ArgumentNullException("index", "If the provided MultiGetRequestedDocuments have no index value the index must be provided to this constructor."); } else if(content.AllIndexesSpecifiedInDocuments && !string.IsNullOrWhiteSpace(index)) { throw new ArgumentException("index", "If the provided MultiGetRequestedDocuments all have an index value the index should not be provided to this constructor."); } } else if (content.DocumentIds != null && content.DocumentIds.Any()) { if (string.IsNullOrWhiteSpace(index)) { throw new ArgumentNullException("index", "MultiGetDocumentRequest requires an index when doing a multi get using document ids."); } if (string.IsNullOrWhiteSpace(documentType)) { throw new ArgumentNullException("documentType", "MultiGetDocumentRequest requires the document type when doing a multi get using document ids."); } } else { throw new ArgumentNullException("content", "MultiGetRequestContent must have the Documents or DocumentIds value populated."); } Index = index; DocumentType = documentType; Content = content; }