public void PASS_GetDocument() { GetDocumentRequest request = new GetDocumentRequest(_Index, _DocumentType, _Id); GetResponse<Tweet> response = tweetRepo.Get(request); Assert.IsNotNull(response); Assert.IsNotNull(response.Document); }
public void PASS_CreateRequest() { GetDocumentRequest request = new GetDocumentRequest(_Index, _Type, _Id); Assert.IsNotNull(request); Assert.AreEqual(_Index, request.Index); Assert.AreEqual(_Type, request.DocumentType); Assert.AreEqual(_Id, request.DocumentId); }
public void PASS_GetDocument_ExcludeMetaData() { GetDocumentRequest request = new GetDocumentRequest(_Index, _DocumentType, _Id) { ExcludeMetaData = true }; GetResponse<Tweet> response = tweetRepo.Get(request); Assert.IsNotNull(response); Assert.IsNotNull(response.Document); }
public void FAIL_CreateRequest_MissingDocumentId() { try { GetDocumentRequest request = new GetDocumentRequest(_Index, _Type, null); } catch (ArgumentNullException ex) { Assert.AreEqual("documentId", ex.ParamName); } }
public void FAIL_CreateRequest_MissingIndex() { try { GetDocumentRequest request = new GetDocumentRequest(null, _Type, _Id); } catch (ArgumentNullException ex) { Assert.AreEqual("index", ex.ParamName); } }
public void PASS_GetDocument_ClusterNotFound() { tweetRepo = new DocumentRepository<Tweet>(new ElasticUriProvider("http://notelastic:9200/"), new HttpLayer()); GetDocumentRequest request = new GetDocumentRequest(_Index, _DocumentType, _Id); try { GetResponse<Tweet> response = tweetRepo.Get(request); Assert.Fail(); } catch (ElasticRequestException ex) { Assert.AreEqual(500, (int)ex.Response.StatusCode); } catch (Exception) { Assert.Fail(); } tweetRepo = new DocumentRepository<Tweet>(clusterUri, new HttpLayer()); }
public void FAIL_GetDocument_IndexNotFound() { GetDocumentRequest request = new GetDocumentRequest("notanindex", _DocumentType, _Id); try { GetResponse<Tweet> response = tweetRepo.Get(request); } catch (IndexMissingException ex) { Assert.AreEqual(404, (int)ex.Response.StatusCode); } }
public void PASS_GetDocument_CustomShards() { GetDocumentRequest request = new GetDocumentRequest(_Index, _DocumentType, _Id) { ShardPreference = new CustomShardPreference("custom") }; GetResponse<Tweet> response = tweetRepo.Get(request); Assert.IsNotNull(response); Assert.IsNotNull(response.Document); }
public void PASS_GetDocument_Refresh() { GetDocumentRequest request = new GetDocumentRequest(_Index, _DocumentType, _Id) { RefreshBeforeSearch = true }; GetResponse<Tweet> response = tweetRepo.Get(request); Assert.IsNotNull(response); Assert.IsNotNull(response.Document); }
public void PASS_GetDocument_Fields() { GetDocumentRequest request = new GetDocumentRequest(_Index, _DocumentType, _Id) { Fields = new List<string> { "Text" } }; GetResponse<Tweet> response = tweetRepo.Get(request); Assert.IsNotNull(response); Assert.IsNotNull(response.Document); Assert.IsNull(response.Document.Author); Assert.IsNotNull(response.Document.Text); }
public void PASS_GetDocument_DisableRealTime() { GetDocumentRequest request = new GetDocumentRequest(_Index, _DocumentType, _Id) { DisableRealTime = true }; GetResponse<Tweet> response = tweetRepo.Get(request); Assert.IsNotNull(response); Assert.IsNotNull(response.Document); }
public void FAIL_GetDocument_DocumentNotFound() { GetDocumentRequest request = new GetDocumentRequest(_Index, _DocumentType, "151515"); GetResponse<Tweet> response = tweetRepo.Get(request); Assert.IsNotNull(response); Assert.AreEqual(false, response.Found); }