@@ -15,15 +15,109 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzCdnEndpoint'))
1515}
1616
1717Describe ' Get-AzCdnEndpoint' {
18- It ' List' - skip {
19- { throw [System.NotImplementedException ] } | Should -Not - Throw
18+ It ' List' {
19+ {
20+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
21+ try
22+ {
23+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
24+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
25+
26+ $cdnProfileName = ' p-' + (RandomString - allChars $false - len 6 );
27+ Write-Host - ForegroundColor Green " Use cdnProfileName : $ ( $cdnProfileName ) "
28+
29+ $profileSku = " Standard_Microsoft" ;
30+ New-AzCdnProfile - SkuName $profileSku - Name $cdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
31+
32+ $endpointName = ' e-' + (RandomString - allChars $false - len 6 );
33+ $origin = @ {
34+ Name = " origin1"
35+ HostName = " host1.hello.com"
36+ };
37+ $location = " westus"
38+ Write-Host - ForegroundColor Green " Create endpointName : $ ( $endpointName ) , origin.Name : $ ( $origin.Name ) , origin.HostName : $ ( $origin.HostName ) "
39+
40+ New-AzCdnEndpoint - Name $endpointName - ResourceGroupName $ResourceGroupName - ProfileName $cdnProfileName - Location $location - Origin $origin
41+ $endpoints = Get-AzCdnEndpoint - ProfileName $cdnProfileName - ResourceGroupName $ResourceGroupName
42+
43+ $endpoints.Count | Should - Be 1
44+ } Finally
45+ {
46+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
47+ }
48+ } | Should -Not - Throw
2049 }
2150
22- It ' Get' - skip {
23- { throw [System.NotImplementedException ] } | Should -Not - Throw
51+ It ' Get' {
52+ {
53+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
54+ try
55+ {
56+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
57+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
58+
59+ $cdnProfileName = ' p-' + (RandomString - allChars $false - len 6 );
60+ Write-Host - ForegroundColor Green " Use cdnProfileName : $ ( $cdnProfileName ) "
61+
62+ $profileSku = " Standard_Microsoft" ;
63+ New-AzCdnProfile - SkuName $profileSku - Name $cdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
64+
65+ $endpointName = ' e-' + (RandomString - allChars $false - len 6 );
66+ $origin = @ {
67+ Name = " origin1"
68+ HostName = " host1.hello.com"
69+ };
70+ $location = " westus"
71+ Write-Host - ForegroundColor Green " Create endpointName : $ ( $endpointName ) , origin.Name : $ ( $origin.Name ) , origin.HostName : $ ( $origin.HostName ) "
72+
73+ New-AzCdnEndpoint - Name $endpointName - ResourceGroupName $ResourceGroupName - ProfileName $cdnProfileName - Location $location - Origin $origin
74+ $endpoint = Get-AzCdnEndpoint - Name $endpointName - ProfileName $cdnProfileName - ResourceGroupName $ResourceGroupName
75+
76+ $endpoint.Name | Should - Be $endpointName
77+ $endpoint.Location | Should - Be $location
78+ $endpoint.Origin.Name | Should - Be $origin.Name
79+ $endpoint.Origin.HostName | Should - Be $origin.HostName
80+ } Finally
81+ {
82+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
83+ }
84+ } | Should -Not - Throw
2485 }
2586
26- It ' GetViaIdentity' - skip {
27- { throw [System.NotImplementedException ] } | Should -Not - Throw
87+ It ' GetViaIdentity' {
88+ {
89+ $PSDefaultParameterValues [' Disabled' ] = $true
90+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
91+ try
92+ {
93+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
94+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
95+
96+ $cdnProfileName = ' p-' + (RandomString - allChars $false - len 6 );
97+ Write-Host - ForegroundColor Green " Use cdnProfileName : $ ( $cdnProfileName ) "
98+
99+ $profileSku = " Standard_Microsoft" ;
100+ New-AzCdnProfile - SkuName $profileSku - Name $cdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
101+
102+ $endpointName = ' e-' + (RandomString - allChars $false - len 6 );
103+ $origin = @ {
104+ Name = " origin1"
105+ HostName = " host1.hello.com"
106+ };
107+ $location = " westus"
108+ Write-Host - ForegroundColor Green " Create endpointName : $ ( $endpointName ) , origin.Name : $ ( $origin.Name ) , origin.HostName : $ ( $origin.HostName ) "
109+
110+ New-AzCdnEndpoint - Name $endpointName - ResourceGroupName $ResourceGroupName - ProfileName $cdnProfileName - Location $location - Origin $origin
111+ $endpoint = Get-AzCdnEndpoint - Name $endpointName - ProfileName $cdnProfileName - ResourceGroupName $ResourceGroupName | Get-AzCdnEndpoint
112+
113+ $endpoint.Name | Should - Be $endpointName
114+ $endpoint.Location | Should - Be $location
115+ $endpoint.Origin.Name | Should - Be $origin.Name
116+ $endpoint.Origin.HostName | Should - Be $origin.HostName
117+ } Finally
118+ {
119+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
120+ }
121+ } | Should -Not - Throw
28122 }
29123}
0 commit comments