private IndexBatch <Hotel> GetTypedRetryBatch() { IEnumerable <string> allKeys = _results.Results.Select(r => r.Key); var exception = new IndexBatchException(_results); IndexBatch <Hotel> originalBatch = IndexBatch.Upload(allKeys.Select(k => new Hotel() { HotelId = k })); return(exception.FindFailedActionsToRetry(originalBatch, h => h.HotelId)); }
private IndexBatch GetRetryBatch() { IEnumerable <string> allKeys = _results.Results.Select(r => r.Key); var exception = new IndexBatchException(_results); IndexBatch originalBatch = IndexBatch.Upload(allKeys.Select(k => new Document() { { KeyFieldName, k } })); return(exception.FindFailedActionsToRetry(originalBatch, KeyFieldName)); }
private static void AssertIsPartialFailure( IndexBatchException e, IndexBatch <Hotel> batch, params string[] failedKeys) { Assert.Equal((HttpStatusCode)207, e.Response.StatusCode); Assert.Equal((HttpStatusCode)207, e.IndexResponse.StatusCode); IndexBatch <Hotel> retryBatch = e.FindFailedActionsToRetry(batch, a => a.HotelId); Assert.Equal(failedKeys.Length, retryBatch.Actions.Count()); SearchAssert.SequenceEqual(failedKeys, retryBatch.Actions.Select(a => a.Document.HotelId)); }
private static void AssertIsPartialFailure( IndexBatchException e, IndexBatch batch, params string[] failedKeys) { Assert.Equal((HttpStatusCode)207, e.Response.StatusCode); Assert.Equal((HttpStatusCode)207, e.IndexResponse.StatusCode); const string KeyFieldName = "hotelId"; IndexBatch retryBatch = e.FindFailedActionsToRetry(batch, KeyFieldName); Assert.Equal(failedKeys.Length, retryBatch.Actions.Count()); SearchAssert.SequenceEqual(failedKeys, retryBatch.Actions.Select(a => a.Document[KeyFieldName].ToString())); }