public void CanRunIndexerAndGetIndexerStatus()
        {
            Run(() =>
            {
                SearchServiceClient searchClient = Data.GetSearchServiceClient();

                Indexer indexer = Data.CreateTestIndexer();

                IndexerDefinitionResponse createResponse = searchClient.Indexers.Create(indexer);
                Assert.Equal(HttpStatusCode.Created, createResponse.StatusCode);

                IndexerGetStatusResponse statusResponse = searchClient.Indexers.GetStatus(indexer.Name);
                Assert.Equal(HttpStatusCode.OK, statusResponse.StatusCode);

                IndexerExecutionInfo info = statusResponse.ExecutionInfo;
                Assert.Equal(IndexerStatus.Running, info.Status);

                AzureOperationResponse runResponse = searchClient.Indexers.Run(indexer.Name);
                Assert.Equal(HttpStatusCode.Accepted, runResponse.StatusCode);

                // Set handler that injects mock_status query string, which results in service
                // returning a well-known mock response
                searchClient.AddHandlerToPipeline(new MockStatusDelegatingHandler());

                statusResponse = searchClient.Indexers.GetStatus(indexer.Name);
                Assert.Equal(HttpStatusCode.OK, statusResponse.StatusCode);

                info = statusResponse.ExecutionInfo;
                Assert.Equal(IndexerStatus.Running, info.Status);

                Assert.Equal(IndexerExecutionStatus.InProgress, info.LastResult.Status);
                Assert.Equal(3, info.ExecutionHistory.Count);

                IndexerExecutionResult newestResult = info.ExecutionHistory[0];
                IndexerExecutionResult middleResult = info.ExecutionHistory[1];
                IndexerExecutionResult oldestResult = info.ExecutionHistory[2];

                Assert.Equal(IndexerExecutionStatus.TransientFailure, newestResult.Status);
                Assert.Equal("The indexer could not connect to the data source", newestResult.ErrorMessage);
                AssertStartAndEndTimeValid(newestResult);

                Assert.Equal(IndexerExecutionStatus.Reset, middleResult.Status);
                AssertStartAndEndTimeValid(middleResult);

                Assert.Equal(IndexerExecutionStatus.Success, oldestResult.Status);
                Assert.Equal(124876, oldestResult.ItemCount);
                Assert.Equal(2, oldestResult.FailedItemCount);
                Assert.Equal("100", oldestResult.InitialTrackingState);
                Assert.Equal("200", oldestResult.FinalTrackingState);
                AssertStartAndEndTimeValid(oldestResult);

                Assert.Equal(2, oldestResult.Errors.Count);

                Assert.Equal("1", oldestResult.Errors[0].Key);
                Assert.Equal("Key field contains unsafe characters", oldestResult.Errors[0].ErrorMessage);

                Assert.Equal("121713", oldestResult.Errors[1].Key);
                Assert.Equal("Item is too large", oldestResult.Errors[1].ErrorMessage);
            });
        }