public Artist[] Init(TestEnvironment environment) { if (_artists != null && _artists.Any()) { return(_artists); } IntegrationTestsRuntime.EnsureCleanEnvironment(); _artists = ClientTestData.Artists.CreateArtists(10); using (var client = IntegrationTestsRuntime.CreateDbClient()) { var bulk = new BulkRequest(); bulk.Include(_artists.Select(i => client.Entities.Serializer.Serialize(i)).ToArray()); var bulkResponse = client.Documents.BulkAsync(bulk).Result; foreach (var row in bulkResponse.Rows) { var artist = _artists.Single(i => i.ArtistId == row.Id); client.Entities.Reflector.RevMember.SetValueTo(artist, row.Rev); } client.Documents.PostAsync(ClientTestData.Views.ArtistsViews).Wait(); var queryRequests = ClientTestData.Views.AllViewIds.Select(id => new QueryViewRequest(id).Configure(q => q.Stale(Stale.UpdateAfter))); var queries = queryRequests.Select(q => client.Views.QueryAsync(q) as Task).ToArray(); Task.WaitAll(queries); } return(_artists); }
public Artist[] Init(TestEnvironment environment) { if (_artists != null && _artists.Any()) { return(_artists); } IntegrationTestsRuntime.EnsureCleanEnvironment(); _artists = ClientTestData.Artists.CreateArtists(2); using (var client = IntegrationTestsRuntime.CreateDbClient()) { var bulk = new BulkRequest(); bulk.Include(_artists.Select(i => client.Entities.Serializer.Serialize(i)).ToArray()); var bulkResponse = client.Documents.BulkAsync(bulk).Result; foreach (var row in bulkResponse.Rows) { var artist = _artists.Single(i => i.ArtistId == row.Id); client.Entities.Reflector.RevMember.SetValueTo(artist, row.Rev); } client.Documents.PostAsync(ClientTestData.Shows.ArtistsShows).Wait(); } return(_artists); }
protected virtual void Dispose(bool disposing) { if (!disposing) { return; } IntegrationTestsRuntime.EnsureCleanEnvironment(); }
internal void Init(TestEnvironment environment) { if (_blogs != null && _blogs.Any()) { return; } IntegrationTestsRuntime.EnsureCleanEnvironment(); _blogs = CloudantTestData.Blogs.CreateAll(); using (var client = IntegrationTestsRuntime.CreateDbClient()) { var bulk = new BulkRequest(); bulk.Include(_blogs.Select(i => client.Entities.Serializer.Serialize(i)).ToArray()); var bulkResponse = client.Documents.BulkAsync(bulk).Result; CreateIndex1(client); CreateIndex2(client); } }