Skip to content

Commit a34ca16

Browse files
committed
Cognitive Services PS 1.0.0
1. Makes reference to Cognitive Services SDK 1.0.0. Also changes some code accordingly. 2. Re-records all test cases. 3. Fixes an account length bug. 4. Reversions to 1.0.0
1 parent a08f043 commit a34ca16

22 files changed

+3061
-3607
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
<AppDesignerFolder>Properties</AppDesignerFolder>
1212
<RootNamespace>Microsoft.Azure.Commands.Management.CognitiveServices.Test</RootNamespace>
1313
<AssemblyName>Microsoft.Azure.Commands.Management.CognitiveServices.Test</AssemblyName>
14-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
1515
<FileAlignment>512</FileAlignment>
1616
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\..\</SolutionDir>
1717
<RestorePackages>true</RestorePackages>
1818
<NuGetPackageImportStamp>f747f8a7</NuGetPackageImportStamp>
19+
<TargetFrameworkProfile />
1920
</PropertyGroup>
2021
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2122
<DebugSymbols>true</DebugSymbols>
@@ -50,9 +51,8 @@
5051
<Reference Include="Microsoft.Azure.Management.Authorization">
5152
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5253
</Reference>
53-
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=0.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.0.2.1-preview\lib\net45\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
55-
<Private>True</Private>
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>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5858
<SpecificVersion>False</SpecificVersion>
@@ -62,8 +62,7 @@
6262
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.6179.26854-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
6363
</Reference>
6464
<Reference Include="Microsoft.Azure.Test.HttpRecorder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
65-
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.6.7-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
66-
<Private>True</Private>
65+
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.8.1\lib\net452\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
6766
</Reference>
6867
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.28.3.860, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6968
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
@@ -72,20 +71,16 @@
7271
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
7372
</Reference>
7473
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
75-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
76-
<Private>True</Private>
74+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
7775
</Reference>
7876
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
79-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.5\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
80-
<Private>True</Private>
77+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.7\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
8178
</Reference>
8279
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
83-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.2.9-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
84-
<Private>True</Private>
80+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.3.0\lib\net452\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
8581
</Reference>
86-
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework">
87-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.5.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
88-
<Private>True</Private>
82+
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
83+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.7.2\lib\net452\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
8984
</Reference>
9085
<Reference Include="Microsoft.Threading.Tasks">
9186
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
@@ -153,7 +148,9 @@
153148
</ProjectReference>
154149
</ItemGroup>
155150
<ItemGroup>
156-
<None Include="packages.config" />
151+
<None Include="packages.config">
152+
<SubType>Designer</SubType>
153+
</None>
157154
<None Include="ScenarioTests\Common.ps1">
158155
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
159156
</None>
@@ -172,6 +169,9 @@
172169
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestGetAccounts.json">
173170
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
174171
</None>
172+
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestMinMaxAccountNames.json">
173+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
174+
</None>
175175
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestNewAccount.json">
176176
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
177177
</None>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,12 @@ public void TestPipingToGetSkus()
109109
{
110110
TestController.NewInstance.RunPsTest("Test-PipingToGetAccountSkus");
111111
}
112+
113+
[Fact]
114+
[Trait(Category.AcceptanceType, Category.CheckIn)]
115+
public void TestMinMaxAccountNames()
116+
{
117+
TestController.NewInstance.RunPsTest("Test-MinMaxAccountName");
118+
}
112119
}
113120
}

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

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ Test Get-AzureRmCognitiveServicesAccount | Set-AzureRmCognitiveServicesAccount
363363
#>
364364
function Test-PipingToSetAzureAccount
365365
{
366-
# Setup
366+
# Setup
367367
$rgname = Get-CognitiveServicesManagementTestResourceName
368368

369369
try
@@ -398,7 +398,7 @@ Test Get-AzureRmCognitiveServicesAccount | Get-AzureRmCognitiveServicesAccountSk
398398
#>
399399
function Test-PipingToGetAccountSkus
400400
{
401-
# Setup
401+
# Setup
402402
$rgname = Get-CognitiveServicesManagementTestResourceName
403403

404404
try
@@ -428,3 +428,37 @@ function Test-PipingToGetAccountSkus
428428
}
429429
}
430430

431+
<#
432+
.SYNOPSIS
433+
Test New-AzureRmCognitiveServicesAccount
434+
#>
435+
function Test-MinMaxAccountName
436+
{
437+
# Setup
438+
$rgname = Get-CognitiveServicesManagementTestResourceName
439+
440+
try
441+
{
442+
# Test
443+
$shortname = 'aa';
444+
$longname = 'testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest';
445+
$skuname = 'S2';
446+
$accounttype = 'TextAnalytics';
447+
$loc = 'West US';
448+
449+
New-AzureRmResourceGroup -Name $rgname -Location $loc;
450+
$shortaccount = New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $shortname -Type $accounttype -SkuName $skuname -Location $loc -Force;
451+
$longaccount = New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $longname -Type $accounttype -SkuName $skuname -Location $loc -Force;
452+
453+
Assert-AreEqual $shortname $shortaccount.AccountName;
454+
Assert-AreEqual $longname $longaccount.AccountName;
455+
456+
Retry-IfException { Remove-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Force; }
457+
}
458+
finally
459+
{
460+
# Cleanup
461+
Clean-ResourceGroup $rgname
462+
}
463+
}
464+

0 commit comments

Comments
 (0)