public PSLocationGetResult(LocationGetResult locationGetResult) { if (locationGetResult == null) { return; } this.Id = locationGetResult.Id; this.Name = locationGetResult.Name; this.Type = locationGetResult.Type; this.Properties = new PSLocationProperties(locationGetResult.Properties); }
public override void ExecuteCmdlet() { if (string.IsNullOrEmpty(Location)) { IEnumerable <LocationGetResult> locationListResult = CosmosDBManagementClient.Locations.ListWithHttpMessagesAsync().GetAwaiter().GetResult().Body; foreach (LocationGetResult locationGetResult in locationListResult) { WriteObject(new PSLocationGetResult(locationGetResult)); } } else { LocationGetResult locationGetResult = CosmosDBManagementClient.Locations.GetWithHttpMessagesAsync(Location).GetAwaiter().GetResult().Body; WriteObject(new PSLocationGetResult(locationGetResult)); } return; }
public void DatabaseAccountLocationsTest() { using (var context = MockContext.Start(this.GetType())) { fixture.Init(context); IEnumerable <LocationGetResult> locationGetResults = this.fixture.CosmosDBManagementClient.Locations.ListWithHttpMessagesAsync().GetAwaiter().GetResult().Body; Assert.True(locationGetResults.Count() > 0); string locationName = ""; foreach (LocationGetResult locationGetResult in locationGetResults) { Assert.NotNull(locationGetResult.Name); Assert.NotNull(locationGetResult.Properties.BackupStorageRedundancies); Assert.NotNull(locationGetResult.Properties.IsResidencyRestricted); Assert.NotNull(locationGetResult.Properties.SupportsAvailabilityZone); locationName = locationGetResult.Name; } LocationGetResult currentLocationGetResult = this.fixture.CosmosDBManagementClient.Locations.GetWithHttpMessagesAsync(locationName).GetAwaiter().GetResult().Body; Assert.NotNull(currentLocationGetResult.Name); Assert.NotNull(currentLocationGetResult.Properties.BackupStorageRedundancies); Assert.NotNull(currentLocationGetResult.Properties.IsResidencyRestricted); Assert.NotNull(currentLocationGetResult.Properties.SupportsAvailabilityZone); } }