public async Task Test_Insert_First_Update_Delete() { var creating = DocumentClientTest.NewDocument(); var created = await _documentClient.InsertAsync(creating, CancellationToken.None); DocumentClientTest.Test(creating, created); var received = await _documentClient.FirstOrDefaultAsync <TestDocument>( created.Id, created.PartitionId, CancellationToken.None); DocumentClientTest.Test(created, received); DocumentClientTest.Update(created); var updated = await _documentClient.UpdateAsync(created, CancellationToken.None); DocumentClientTest.Test(created, updated); await _documentClient.DeleteAsync(updated.Id, updated.PartitionId, CancellationToken.None); var deleted = await _documentClient.FirstOrDefaultAsync <TestDocument>( updated.Id, updated.PartitionId, CancellationToken.None); Assert.IsNull(deleted); }
public async Task Test_AsEnumerable() { var document0 = await _documentClient.InsertAsync( DocumentClientTest.NewDocument(), CancellationToken.None); var document1 = await _documentClient.InsertAsync( DocumentClientTest.NewDocument(), CancellationToken.None); var document2 = await _documentClient.InsertAsync( DocumentClientTest.NewDocument(), CancellationToken.None); var document3 = await _documentClient.InsertAsync( DocumentClientTest.NewDocument(), CancellationToken.None); var document4 = await _documentClient.InsertAsync( DocumentClientTest.NewDocument(), CancellationToken.None); await foreach (var document in _documentClient.AsAsyncEnumerable <TestDocument>( nameof(TestDocument), "SELECT * FROM c", null, null, CancellationToken.None)) { Assert.IsNotNull(document); } await _documentClient.DeleteAsync(document0.Id, document0.PartitionId, CancellationToken.None); await _documentClient.DeleteAsync(document1.Id, document1.PartitionId, CancellationToken.None); await _documentClient.DeleteAsync(document2.Id, document2.PartitionId, CancellationToken.None); await _documentClient.DeleteAsync(document3.Id, document3.PartitionId, CancellationToken.None); await _documentClient.DeleteAsync(document4.Id, document4.PartitionId, CancellationToken.None); }
public async Task Test_Double_Update() { var creating = DocumentClientTest.NewDocument(); var created = await _documentClient.InsertAsync(creating, CancellationToken.None); var document0 = created; var document1 = created; DocumentClientTest.Update(document0); DocumentClientTest.Update(document1); var updated0 = await _documentClient.UpdateAsync(document0, CancellationToken.None); var updated1 = await _documentClient.UpdateAsync(document1, CancellationToken.None); DocumentClientTest.Test(updated0, updated1); }