public async Task TryToAddExistentDocument() { var personDocumentAdded = await IntegrationTestsUtils .InsertDocumentAsync("1", "Beatriz1", "Elena", "Saldarriaga", _commandCosmosDbRepository, _documentsToDelete).ConfigureAwait(false); var documentException = Assert.ThrowsAsync <DocumentException <Documents.Person> >(() => _commandCosmosDbRepository.AddDocumentAsync(personDocumentAdded)); Assert.IsTrue(documentException.Document != null); }
public async Task DeleteDocument() { var personDocumentAdded = await IntegrationTestsUtils .InsertDocumentAsync("6", "Beatriz3", "Elena", "Johnson", _commandCosmosDbRepository, _documentsToDelete, false) .ConfigureAwait(false); var cosmosDocumentResponse = await _commandCosmosDbRepository.DeleteDocumentAsync(personDocumentAdded).ConfigureAwait(false); Assert.IsTrue(cosmosDocumentResponse.HttpStatusCode == HttpStatusCode.NoContent); Assert.IsTrue(cosmosDocumentResponse.RequestCharge > 0); Assert.IsTrue(cosmosDocumentResponse.Entities.FirstOrDefault() == null); }
public async Task UpdateDocument() { var personDocumentAdded = await IntegrationTestsUtils .InsertDocumentAsync("4", "Chris", "Jerry", "Johnson", _commandCosmosDbRepository, _documentsToDelete).ConfigureAwait(false); var personDocumentToUpdate = IntegrationTestsUtils.CreateDocument(personDocumentAdded.DocumentId, "Carlos2", "Carrero", "Johnson"); var cosmosDocumentResponse = await _commandCosmosDbRepository.UpdateDocumentAsync(personDocumentToUpdate).ConfigureAwait(false); Assert.IsTrue(cosmosDocumentResponse.HttpStatusCode == HttpStatusCode.OK); Assert.IsTrue(cosmosDocumentResponse.RequestCharge > 0); Assert.IsTrue(cosmosDocumentResponse.Entities.FirstOrDefault()?.FamilyName == "Johnson"); Assert.IsTrue(cosmosDocumentResponse.Entities.FirstOrDefault()?.FirstName == "Carlos2"); Assert.IsTrue(cosmosDocumentResponse.Entities.FirstOrDefault()?.MiddleName == "Carrero"); }