Skip to content

Commit fe0f8ec

Browse files
authored
Merge pull request #319 from felixwa/felixwa/Fixes-Paging
[Cognitive Services] Fixes paging issue
2 parents 0a0dd87 + 160243b commit fe0f8ec

File tree

9 files changed

+29691
-10
lines changed

9 files changed

+29691
-10
lines changed

src/ResourceManager/CognitiveServices/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Integrate with Cognitive Services Management SDK version 2.0.0.
22+
* Get-AzureRmCognitiveServicesAccount now can correctly support paging.
2123

2224
## Version 0.8.4
2325

src/ResourceManager/CognitiveServices/CognitiveServices.Test/Commands.Management.CognitiveServices.Test.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
5050
</Reference>
5151
<Reference Include="Microsoft.Azure.Management.Authorization">
52-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
52+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5353
</Reference>
54-
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
55-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.1.0.0\lib\net452\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
54+
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
55+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.2.0.0\lib\net452\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5858
<SpecificVersion>False</SpecificVersion>
@@ -175,6 +175,9 @@
175175
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestGetAccounts.json">
176176
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
177177
</None>
178+
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestGetWithPaging.json">
179+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
180+
</None>
178181
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestMinMaxAccountNames.json">
179182
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
180183
</None>

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/CognitiveServicesAccountTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,12 @@ public void TestMinMaxAccountNames()
118118
{
119119
TestController.NewInstance.RunPsTest("Test-MinMaxAccountName");
120120
}
121+
122+
[Fact]
123+
[Trait(Category.AcceptanceType, Category.CheckIn)]
124+
public void TestGetWithPaging()
125+
{
126+
TestController.NewInstance.RunPsTest("Test-GetWithPaging");
127+
}
121128
}
122129
}

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/CognitiveServicesAccountTests.ps1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,43 @@ function Test-MinMaxAccountName
462462
}
463463
}
464464

465+
<#
466+
.SYNOPSIS
467+
Test Test-GetWithPaging
468+
#>
469+
function Test-GetWithPaging
470+
{
471+
# Setup
472+
$rgname = Get-CognitiveServicesManagementTestResourceName
473+
$loc = 'West US'
474+
475+
try
476+
{
477+
$TotalCount = 100
478+
# Test
479+
New-AzureRmResourceGroup -Name $rgname -Location $loc
480+
481+
# 100 Face
482+
For($i = 0; $i -lt $TotalCount ; $i++)
483+
{
484+
New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name "facepaging_wu_$i" -Type 'Face' -SkuName 'S0' -Location $loc -Force;
485+
}
486+
487+
# 100 Emotion
488+
For($i = 0; $i -lt $TotalCount ; $i++)
489+
{
490+
New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name "emotionpaging_wu_$i" -Type 'Emotion' -SkuName 'S0' -Location $loc -Force;
491+
}
492+
493+
$accounts = Get-AzureRmCognitiveServicesAccount
494+
Assert-AreEqual 200 $accounts.Count
495+
496+
$accounts = Get-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname
497+
Assert-AreEqual 200 $accounts.Count
498+
}
499+
finally
500+
{
501+
# Cleanup
502+
Clean-ResourceGroup $rgname
503+
}
504+
}

0 commit comments

Comments
 (0)