Created
September 26, 2021 02:20
-
-
Save ManfredLange/23f0d1131d0944528e62785d9f5ba75f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace CosmosDbTest | |
{ | |
public class CosmosDbTests | |
{ | |
[OneTimeTearDown] | |
public void OneTimeTearDown() | |
{ | |
//Dispose of CosmosClient | |
_cosmosClient.Dispose(); // Move this to teardown of fixture | |
} | |
// ... other code left out for brevity ... | |
[Test] | |
public async Task CosmosDemo() | |
{ | |
await GetStartedDemoAsync().ConfigureAwait(false); | |
} | |
/// <summary> | |
/// Entry point to call methods that operate on Azure Cosmos DB resources in this sample | |
/// </summary> | |
private async Task GetStartedDemoAsync() | |
{ | |
// Create a new instance of the Cosmos Client | |
_cosmosClient = new CosmosClient(EndpointUri, PrimaryKey, new CosmosClientOptions() { ApplicationName = "CosmosDBDotnetQuickstart" }); | |
await CreateDatabaseAsync().ConfigureAwait(false); | |
await CreateContainerAsync().ConfigureAwait(false); | |
await ScaleContainerAsync().ConfigureAwait(false); | |
await AddItemsToContainerAsync().ConfigureAwait(false); | |
await QueryItemsAsync().ConfigureAwait(false); | |
await ReplaceFamilyItemAsync().ConfigureAwait(false); | |
await DeleteFamilyItemAsync().ConfigureAwait(false); | |
await DeleteDatabaseAndCleanupAsync().ConfigureAwait(false); | |
} | |
// ... other code left out for brevity | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment