public async Task GetAllInSubscription() { var datastoreName = Recording.GenerateAssetName("testdatastore"); var _datastoreCollection = await GetVMwareDatastoreCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, Type = EXTENDED_LOCATION_TYPE }; var datastoreBody = new VMwareDatastoreData(DefaultLocation); datastoreBody.MoRefId = "datastore-11"; datastoreBody.VCenterId = VcenterId; datastoreBody.ExtendedLocation = _extendedLocation; // create datastore VMwareDatastore datastore1 = (await _datastoreCollection.CreateOrUpdateAsync(true, 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, Type = EXTENDED_LOCATION_TYPE }; var datastoreBody = new VMwareDatastoreData(DefaultLocation); datastoreBody.MoRefId = "datastore-11"; datastoreBody.VCenterId = VcenterId; datastoreBody.ExtendedLocation = _extendedLocation; // create datastore VMwareDatastore datastore1 = (await _datastoreCollection.CreateOrUpdateAsync(true, datastoreName, datastoreBody)).Value; Assert.IsNotNull(datastore1); Assert.AreEqual(datastore1.Id.Name, datastoreName); // check for exists datastore datastore1 = await _datastoreCollection.GetIfExistsAsync(datastoreName); Assert.AreEqual(datastore1.Id.Name, datastoreName); }
public async Task GetAll() { var datastoreName = Recording.GenerateAssetName("testdatastore"); var _datastoreCollection = await GetVMwareDatastoreCollectionAsync(); var _extendedLocation = new ExtendedLocation() { Name = CustomLocationId, Type = EXTENDED_LOCATION_TYPE }; var datastoreBody = new VMwareDatastoreData(DefaultLocation); datastoreBody.MoRefId = "datastore-11"; datastoreBody.VCenterId = VcenterId; datastoreBody.ExtendedLocation = _extendedLocation; // create datastore VMwareDatastore datastore1 = (await _datastoreCollection.CreateOrUpdateAsync(true, 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); }