public async Task GetAllInSubscription() { var resourcePoolName = Recording.GenerateAssetName("testresourcepool"); var _resourcePoolCollection = await GetResourcePoolCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var resourcePoolBody = new ResourcePoolData(DefaultLocation); resourcePoolBody.MoRefId = "resgroup-89261"; resourcePoolBody.VCenterId = VcenterId; resourcePoolBody.ExtendedLocation = _extendedLocation; // create resource pool ResourcePoolResource resourcePool1 = (await _resourcePoolCollection.CreateOrUpdateAsync(WaitUntil.Completed, resourcePoolName, resourcePoolBody)).Value; Assert.IsNotNull(resourcePool1); Assert.AreEqual(resourcePool1.Id.Name, resourcePoolName); resourcePool1 = null; await foreach (var resourcePool in DefaultSubscription.GetResourcePoolsAsync()) { if (resourcePool.Data.Name == resourcePoolName) { resourcePool1 = resourcePool; } } Assert.NotNull(resourcePool1); }
public async Task Exists() { var resourcePoolName = Recording.GenerateAssetName("testresourcepool"); var _resourcePoolCollection = await GetResourcePoolCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var resourcePoolBody = new ResourcePoolData(DefaultLocation); resourcePoolBody.MoRefId = "resgroup-87730"; resourcePoolBody.VCenterId = VcenterId; resourcePoolBody.ExtendedLocation = _extendedLocation; // create resource pool ResourcePoolResource resourcePool1 = (await _resourcePoolCollection.CreateOrUpdateAsync(WaitUntil.Completed, resourcePoolName, resourcePoolBody)).Value; Assert.IsNotNull(resourcePool1); Assert.AreEqual(resourcePool1.Id.Name, resourcePoolName); // check for exists resource pool bool exists = await _resourcePoolCollection.ExistsAsync(resourcePoolName); Assert.IsTrue(exists); }
public async Task GetAll() { var resourcePoolName = Recording.GenerateAssetName("testresourcepool"); var _resourcePoolCollection = await GetResourcePoolCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var resourcePoolBody = new ResourcePoolData(DefaultLocation); resourcePoolBody.MoRefId = "resgroup-119001"; resourcePoolBody.VCenterId = VcenterId; resourcePoolBody.ExtendedLocation = _extendedLocation; // create resource pool ResourcePoolResource resourcePool1 = (await _resourcePoolCollection.CreateOrUpdateAsync(WaitUntil.Completed, resourcePoolName, resourcePoolBody)).Value; Assert.IsNotNull(resourcePool1); Assert.AreEqual(resourcePool1.Id.Name, resourcePoolName); int count = 0; await foreach (var resourcePool in _resourcePoolCollection.GetAllAsync()) { count++; } Assert.GreaterOrEqual(count, 1); }