-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
34 changes: 34 additions & 0 deletions
34
net/JonGallant.Azure.Identity.Extensions.Tests/CosmosDBTests.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using DotNetEnv; | ||
using Microsoft.Azure.Management.CosmosDB; | ||
using Microsoft.Azure.Management.CosmosDB.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace JonGallant.Azure.Identity.Extensions.Tests | ||
{ | ||
public class CosmosDBTests | ||
{ | ||
[Fact] | ||
public void CreateCosmosDBTest() | ||
{ | ||
Env.Load("../../../.env"); | ||
|
||
|
||
var client = new CosmosDBManagementClient(new DefaultAzureMgmtCredential()); | ||
client.SubscriptionId = Environment.GetEnvironmentVariable("AZURE_SUBSCRIPTION_ID"); | ||
|
||
var name = Environment.GetEnvironmentVariable("COSMOSDB_NAME") + Guid.NewGuid().ToString("n").Substring(0, 8); | ||
|
||
var parameters = new DatabaseAccountCreateUpdateParameters | ||
{ | ||
Location = Environment.GetEnvironmentVariable("AZURE_REGION"), | ||
Locations = new List<Location> { new Location(locationName: Environment.GetEnvironmentVariable("AZURE_REGION")) } | ||
}; | ||
|
||
var results = client.DatabaseAccounts.CreateOrUpdate(Environment.GetEnvironmentVariable("AZURE_RESOURCE_GROUP"), name, parameters); | ||
|
||
Assert.Equal(results.Name, name); | ||
} | ||
} | ||
} |
This file contains 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