public async Task MainTest() { string rgName = SdkContext.RandomResourceName("rgRSMA", 24); string networkInterfaceName = SdkContext.RandomResourceName("netinf", 24); string ipLabel = SdkContext.RandomResourceName("rgRSMA", 12); ResourceGroups oResourceGroups = new ResourceGroups(this.credentials, this.subscriptionId); oResourceGroups.Create(rgName, this.region); var networkInferface = new NetworkInterfaces(credentials, subscriptionId); networkInferface.Create(networkInterfaceName, rgName, this.region, "10.0.0.0/28", "test"); var resources = await oResourceGroups.GetResources(rgName); Assert.AreEqual(Formatter.CountPageable(resources), 2); await networkInferface.Del(networkInterfaceName, rgName, true); Thread.Sleep(20000); var resourcesAfterDel = await oResourceGroups.GetResources(rgName); // there is this thing called, smartDetectorAlertRules/Failure Anomalies Assert.LessOrEqual(Formatter.CountPageable(resourcesAfterDel), 1); oResourceGroups.Del(rgName); }
public async Task MainTest() { string rgName = SdkContext.RandomResourceName("rgRSMA", 24); string virtualNetworkName = SdkContext.RandomResourceName("vnet", 24); ResourceGroups oResourceGroups = new ResourceGroups(this.credentials, this.subscriptionId); oResourceGroups.Create(rgName, this.region); var virtualNetwork = new VirtualNetworks(credentials, subscriptionId); await virtualNetwork.Create(virtualNetworkName, rgName, new List <string>() { "10.0.0.0/28" }, new List <string>() { "1.1.1.1", "1.1.2.4" }); var resources = await oResourceGroups.GetResources(rgName); Assert.AreEqual(Formatter.CountPageable(resources), 1); await virtualNetwork.Del(virtualNetworkName, rgName); var resourcesAfterDel = await oResourceGroups.GetResources(rgName); Assert.LessOrEqual(Formatter.CountPageable(resourcesAfterDel), 0); oResourceGroups.Del(rgName); }
public async Task MainTest() { string rgName = SdkContext.RandomResourceName("rgRSMA", 24); string diskName = SdkContext.RandomResourceName("disk", 24); ResourceGroups oResourceGroups = new ResourceGroups(this.credentials, this.subscriptionId); oResourceGroups.Create(rgName, this.region); var disk = new Disks(credentials, subscriptionId); disk.Create(diskName, rgName, this.region, 50); var resources = await oResourceGroups.GetResources(rgName); Assert.AreEqual(Formatter.CountPageable(resources), 1); disk.Del(diskName, rgName); var resourcesAfterDel = await oResourceGroups.GetResources(rgName); Assert.LessOrEqual(Formatter.CountPageable(resourcesAfterDel), 0); oResourceGroups.Del(rgName); }
public async Task MainTest() { string rgName = SdkContext.RandomResourceName("rgRSMA", 24); string vmName = SdkContext.RandomResourceName("rgRSMA", 24); string ipLabel = SdkContext.RandomResourceName("rgRSMA", 12); ResourceGroups oResourceGroups = new ResourceGroups(this.credentials, this.subscriptionId); oResourceGroups.Create(rgName, this.region); var vm = new VirtualMachines(credentials, subscriptionId); vm.CreateWindowsVM(vmName, rgName, this.region, "10.0.0.0/28", ipLabel, KnownWindowsVirtualMachineImage.WindowsServer2008R2_SP1, "adminUser", "Password@123", VirtualMachineSizeTypes.StandardA0); var resources = await oResourceGroups.GetResources(rgName); Assert.AreEqual(Formatter.CountPageable(resources), 5); await vm.Del(vmName, rgName, true); var resourcesAfterDel = await oResourceGroups.GetResources(rgName); Assert.AreEqual(Formatter.CountPageable(resourcesAfterDel), 0); oResourceGroups.Del(rgName); }
public async Task MainTest() { string rgName = SdkContext.RandomResourceName("rgRSMA", 24); string publicIPAddrName = SdkContext.RandomResourceName("pubIP", 24); ResourceGroups oResourceGroups = new ResourceGroups(this.credentials, this.subscriptionId); oResourceGroups.Create(rgName, this.region); var publicIPAddr = new PublicIPAddresses(credentials, subscriptionId); publicIPAddr.Create(publicIPAddrName, rgName, this.region); var resources = await oResourceGroups.GetResources(rgName); Assert.AreEqual(Formatter.CountPageable(resources), 1); publicIPAddr.Del(publicIPAddrName, rgName); var resourcesAfterDel = await oResourceGroups.GetResources(rgName); // there is this thing called, smartDetectorAlertRules/Failure Anomalies Assert.LessOrEqual(Formatter.CountPageable(resourcesAfterDel), 1); oResourceGroups.Del(rgName); }
public async Task End2EndTest() { string rgName = SdkContext.RandomResourceName("rgRSMA", 24); string blobAccountName = SdkContext.RandomResourceName("rgRSMA", 24); ResourceGroups oResourceGroups = new ResourceGroups(this.credentials, this.subscriptionId); oResourceGroups.Create(rgName, this.region); Assert.True(oResourceGroups.IsExist(rgName)); StorageBlobs oStorageBlobs = new StorageBlobs(credentials, subscriptionId, rgName); oStorageBlobs.Create(blobAccountName, this.region); var resources = await oResourceGroups.GetResources(rgName); int count = 0; foreach (var resource in resources) { if (resource.Kind == StorageBlobs.KIND) { Assert.True(oStorageBlobs.IsExist(resource.Name)); } else { Assert.True(false); } count++; } Assert.AreEqual(count, 1); oStorageBlobs.Del(blobAccountName); Trace.WriteLine("Delete Storage Account"); Assert.False(oStorageBlobs.IsExist(blobAccountName)); oResourceGroups.Del(rgName); Assert.False(oResourceGroups.IsExist(rgName)); }
public void SanityTest() { string rgName = SdkContext.RandomResourceName("rgRSMA", 24); string blobAccountName = SdkContext.RandomResourceName("rgRSMA", 24); string containerName = "dummycontainer"; ResourceGroups oResourceGroups = new ResourceGroups(this.credentials, this.subscriptionId); oResourceGroups.Create(rgName, this.region); StorageBlobs oStorageBlobs = new StorageBlobs(credentials, subscriptionId, rgName); oStorageBlobs.Create(blobAccountName, this.region); Assert.AreEqual(Formatter.CountPageable(oStorageBlobs.GetContainers(blobAccountName)), 0); oStorageBlobs.CreateBlobContainer(blobAccountName, containerName); Assert.AreEqual(Formatter.CountPageable(oStorageBlobs.GetContainers(blobAccountName)), 1); oStorageBlobs.DelBlobContainer(blobAccountName, containerName); Assert.AreEqual(Formatter.CountPageable(oStorageBlobs.GetContainers(blobAccountName)), 0); // Blob Storage Account shall be deleted once resource group is deleted. oResourceGroups.Del(rgName); }