public async Task GetAllInSubscription() { var clusterName = Recording.GenerateAssetName("testcluster"); var _clusterCollection = await GetVMwareClusterCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var clusterBody = new VMwareClusterData(DefaultLocation); clusterBody.MoRefId = "domain-c7"; clusterBody.VCenterId = VcenterId; clusterBody.ExtendedLocation = _extendedLocation; // create cluster VMwareCluster cluster1 = (await _clusterCollection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, clusterBody)).Value; Assert.IsNotNull(cluster1); Assert.AreEqual(cluster1.Id.Name, clusterName); cluster1 = null; await foreach (var cluster in DefaultSubscription.GetVMwareClustersAsync()) { if (cluster.Data.Name == clusterName) { cluster1 = cluster; } } Assert.NotNull(cluster1); }
public async Task Exists() { var clusterName = Recording.GenerateAssetName("testcluster"); var _clusterCollection = await GetVMwareClusterCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var clusterBody = new VMwareClusterData(DefaultLocation); clusterBody.MoRefId = "domain-c7"; clusterBody.VCenterId = VcenterId; clusterBody.ExtendedLocation = _extendedLocation; // create cluster VMwareCluster cluster1 = (await _clusterCollection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, clusterBody)).Value; Assert.IsNotNull(cluster1); Assert.AreEqual(cluster1.Id.Name, clusterName); // check for exists cluster cluster1 = await _clusterCollection.GetIfExistsAsync(clusterName); Assert.AreEqual(cluster1.Id.Name, clusterName); }
public async Task GetAll() { var clusterName = Recording.GenerateAssetName("testcluster"); var _clusterCollection = await GetVMwareClusterCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, Type = EXTENDED_LOCATION_TYPE }; var clusterBody = new VMwareClusterData(DefaultLocation); clusterBody.MoRefId = "domain-c7"; clusterBody.VCenterId = VcenterId; clusterBody.ExtendedLocation = _extendedLocation; // create cluster VMwareCluster cluster1 = (await _clusterCollection.CreateOrUpdateAsync(true, clusterName, clusterBody)).Value; Assert.IsNotNull(cluster1); Assert.AreEqual(cluster1.Id.Name, clusterName); int count = 0; await foreach (var cluster in _clusterCollection.GetAllAsync()) { count++; } Assert.GreaterOrEqual(count, 1); }