11$Config = Get-Content $PSScriptRoot \..\Tests\Acceptance.Config.json - Raw | ConvertFrom-Json
22Push-Location - Path $PSScriptRoot \..\Infrastructure\Resources\
33
4+ $ValidGuid = [System.Guid ]::NewGuid()
5+
46Describe " New-ApplicationInsights Tests" - Tag " Acceptance-ARM" {
57
68 $ResourceGroupName = " $ ( $Config.ResourceGroupName ) $ ( $Config.suffix ) "
79 $AppInsightsName = " $ ( $Config.appInsightsName ) $ ( $Config.suffix ) "
810
9- It " Should create an ApplicationInsights and return a valid instrumentation key " {
11+ It " Should create an ApplicationInsights and return a valid Instrumentation Key and App Id " {
1012 $Result = .\New-ApplicationInsights.ps1 - Location $Config.location - Name $AppInsightsName - ResourceGroupName $ResourceGroupName
11- $Result.Count | Should Be 1
12- $Result.Contains (" InstrumentationKey" ) | Should Be $true
13- $Result = $Result.Split (" ]" )[1 ]
14- $ValidGuid = [System.Guid ]::NewGuid()
15- $Success = [System.Guid ]::TryParse($Result , [ref ]$ValidGuid );
13+ $Result.Count | Should Be 2
14+ $ik = $Result | Where-Object { $_.Contains (" InstrumentationKey" ) }
15+ $ik.Contains (" InstrumentationKey" ) | Should Be $true
16+ $ikguid = $ik.Split (" ]" )[1 ]
17+ $Success = [System.Guid ]::TryParse($ikguid , [ref ]$ValidGuid );
18+ $Success | Should Be $true
19+ $aid = $Result | Where-Object { $_.Contains (" AppId" ) }
20+ $aid.Contains (" AppId" ) | Should Be $true
21+ $aidguid = $aid.Split (" ]" )[1 ]
22+ $Success = [System.Guid ]::TryParse($aidguid , [ref ]$ValidGuid );
1623 $Success | Should Be $true
1724 }
1825
19- It " Should return a valid instrumentation key on subsequent runs" {
26+ It " Should return a valid Instrumentation Key and App Id on subsequent runs" {
2027 $Result = .\New-ApplicationInsights.ps1 - Location $Config.location - Name $AppInsightsName - ResourceGroupName $ResourceGroupName
21- $Result.Count | Should Be 1
22- $Result.Contains (" InstrumentationKey" ) | Should Be $true
23- $Result = $Result.Split (" ]" )[1 ]
24- $ValidGuid = [System.Guid ]::NewGuid()
25- $Success = [System.Guid ]::TryParse($Result , [ref ]$ValidGuid );
28+ $Result.Count | Should Be 2
29+ $ik = $Result | Where-Object { $_.Contains (" InstrumentationKey" ) }
30+ $ik.Contains (" InstrumentationKey" ) | Should Be $true
31+ $ikguid = $ik.Split (" ]" )[1 ]
32+ $Success = [System.Guid ]::TryParse($ikguid , [ref ]$ValidGuid );
33+ $Success | Should Be $true
34+ $aid = $Result | Where-Object { $_.Contains (" AppId" ) }
35+ $aid.Contains (" AppId" ) | Should Be $true
36+ $aidguid = $aid.Split (" ]" )[1 ]
37+ $Success = [System.Guid ]::TryParse($aidguid , [ref ]$ValidGuid );
2638 $Success | Should Be $true
2739 }
2840}
2941
30- Pop-Location
42+ Pop-Location
0 commit comments