public async Task GetAllInSubscription() { var datastoreName = Recording.GenerateAssetName("testdatastore"); var _datastoreCollection = await GetVMwareDatastoreCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var datastoreBody = new VMwareDatastoreData(DefaultLocation); datastoreBody.MoRefId = "datastore-11"; datastoreBody.VCenterId = VcenterId; datastoreBody.ExtendedLocation = _extendedLocation; // create datastore VMwareDatastoreResource datastore1 = (await _datastoreCollection.CreateOrUpdateAsync(WaitUntil.Completed, datastoreName, datastoreBody)).Value; Assert.IsNotNull(datastore1); Assert.AreEqual(datastore1.Id.Name, datastoreName); datastore1 = null; await foreach (var datastore in DefaultSubscription.GetVMwareDatastoresAsync()) { if (datastore.Data.Name == datastoreName) { datastore1 = datastore; } } Assert.NotNull(datastore1); }
public async Task Exists() { var datastoreName = Recording.GenerateAssetName("testdatastore"); var _datastoreCollection = await GetVMwareDatastoreCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var datastoreBody = new VMwareDatastoreData(DefaultLocation); datastoreBody.MoRefId = "datastore-11"; datastoreBody.VCenterId = VcenterId; datastoreBody.ExtendedLocation = _extendedLocation; // create datastore VMwareDatastoreResource datastore1 = (await _datastoreCollection.CreateOrUpdateAsync(WaitUntil.Completed, datastoreName, datastoreBody)).Value; Assert.IsNotNull(datastore1); Assert.AreEqual(datastore1.Id.Name, datastoreName); // check for exists datastore bool exists = await _datastoreCollection.ExistsAsync(datastoreName); Assert.IsTrue(exists); }
public async Task GetAll() { var datastoreName = Recording.GenerateAssetName("testdatastore"); var _datastoreCollection = await GetVMwareDatastoreCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, ExtendedLocationType = EXTENDED_LOCATION_TYPE }; var datastoreBody = new VMwareDatastoreData(DefaultLocation); datastoreBody.MoRefId = "datastore-11"; datastoreBody.VCenterId = VcenterId; datastoreBody.ExtendedLocation = _extendedLocation; // create datastore VMwareDatastoreResource datastore1 = (await _datastoreCollection.CreateOrUpdateAsync(WaitUntil.Completed, datastoreName, datastoreBody)).Value; Assert.IsNotNull(datastore1); Assert.AreEqual(datastore1.Id.Name, datastoreName); int count = 0; await foreach (var cluster in _datastoreCollection.GetAllAsync()) { count++; } Assert.GreaterOrEqual(count, 1); }