Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.Test.props" />

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.MixedReality" Version="0.9.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.MixedReality" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.MixedReality.Test
{
public class RemoteRenderingAccountTests
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public RemoteRenderingAccountTests(Xunit.Abstractions.ITestOutputHelper output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoteRenderingAccountOperations()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-RemoteRenderingAccountOperations");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRemoteRenderingAccountOperationsWithPiping()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-RemoteRenderingAccountOperationsWithPiping");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestListRemoteRenderingAccounts()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ListRemoteRenderingAccounts");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Create Get and Delete Remote Rendering Account
#>
function Test-RemoteRenderingAccountOperations
{
$resourceGroup = TestSetup-CreateResourceGroup
$resourceLocation = "EastUS2"
$accountName = getAssetName

$createdAccount = New-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -Location $resourceLocation
Assert-AreEqual $accountName $createdAccount.Name
Assert-AreEqual $resourceGroup.ResourceGroupName $createdAccount.ResourceGroupName
Assert-AreEqual $resourceLocation $createdAccount.Location

$account = Get-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName
Assert-AreEqual $accountName $account.Name
Assert-AreEqual $resourceGroup.ResourceGroupName $account.ResourceGroupName
Assert-AreEqual $resourceLocation $account.Location

Assert-ThrowsContains { New-AzRemoteRenderingAccountKey -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -Force } "Parameter set cannot be resolved using the specified named parameters."

$old = Get-AzRemoteRenderingAccountKey -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName
$new = New-AzRemoteRenderingAccountKey -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -Primary -Force
Assert-AreNotEqual $old.PrimaryKey $new.PrimaryKey

$old = $new
$new = New-AzRemoteRenderingAccountKey -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -Secondary -Force
Assert-AreNotEqual $old.SecondaryKey $new.SecondaryKey

$accountRemoved = Remove-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -PassThru
Assert-True{$accountRemoved}

Assert-ThrowsContains { Get-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName } "not found"

Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}

<#
.SYNOPSIS
Create Get and Delete Remote Rendering Account
#>
function Test-RemoteRenderingAccountOperationsWithPiping
{
$resourceGroup = TestSetup-CreateResourceGroup
$resourceLocation = "EastUS2"
$accountName = getAssetName

$createdAccount = New-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -Location $resourceLocation
Assert-AreEqual $accountName $createdAccount.Name
Assert-AreEqual $resourceGroup.ResourceGroupName $createdAccount.ResourceGroupName
Assert-AreEqual $resourceLocation $createdAccount.Location

Assert-ThrowsContains { $createdAccount | New-AzRemoteRenderingAccountKey -Force } "Parameter set cannot be resolved using the specified named parameters."

$old = $createdAccount | Get-AzRemoteRenderingAccountKey
$new = $createdAccount | New-AzRemoteRenderingAccountKey -Primary -Force
Assert-AreNotEqual $old.PrimaryKey $new.PrimaryKey

$old = $new
$new = $createdAccount | New-AzRemoteRenderingAccountKey -Secondary -Force
Assert-AreNotEqual $old.SecondaryKey $new.SecondaryKey

$accountRemoved = $createdAccount | Remove-AzRemoteRenderingAccount -PassThru
Assert-True{$accountRemoved}

Assert-ThrowsContains { Get-AzRemoteRenderingAccount -Id $createdAccount.Id } "not found"

Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}

<#
.SYNOPSIS
Endpoint pipeline exercise
#>
function Test-ListRemoteRenderingAccounts
{
$resourceGroup = TestSetup-CreateResourceGroup
$resourceLocation = "EastUS2"
$accountName = getAssetName

$accounts = Get-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName
$originalCount = $accounts.Count

$createdAccount = New-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -Location $resourceLocation
Assert-AreEqual $accountName $createdAccount.Name
Assert-AreEqual $resourceGroup.ResourceGroupName $createdAccount.ResourceGroupName
Assert-AreEqual $resourceLocation $createdAccount.Location

$accounts = Get-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName
Assert-AreEqual $accounts.Count ($originalCount + 1)

$old = Get-AzRemoteRenderingAccountKey -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName
$new = New-AzRemoteRenderingAccountKey -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -Primary -Force
Assert-AreNotEqual $old.PrimaryKey $new.PrimaryKey

$old = $new
$new = New-AzRemoteRenderingAccountKey -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -Secondary -Force
Assert-AreNotEqual $old.SecondaryKey $new.SecondaryKey

$accountRemoved = Remove-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -PassThru
Assert-True{$accountRemoved}

$accounts = Get-AzRemoteRenderingAccount -ResourceGroupName $resourceGroup.ResourceGroupName
Assert-AreEqual $accounts.Count $originalCount

Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function Test-SpatialAnchorsAccountOperations
$accountRemoved = Remove-AzSpatialAnchorsAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName -PassThru
Assert-True{$accountRemoved}

Assert-ThrowsContains { Get-AzSpatialAnchorsAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName } "NotFound"
Assert-ThrowsContains { Get-AzSpatialAnchorsAccount -ResourceGroupName $resourceGroup.ResourceGroupName -Name $accountName } "not found"

Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}
Expand Down Expand Up @@ -78,7 +78,7 @@ function Test-SpatialAnchorsAccountOperationsWithPiping
$accountRemoved = $createdAccount | Remove-AzSpatialAnchorsAccount -PassThru
Assert-True{$accountRemoved}

Assert-ThrowsContains { Get-AzSpatialAnchorsAccount -Id $createdAccount.Id } "NotFound"
Assert-ThrowsContains { Get-AzSpatialAnchorsAccount -Id $createdAccount.Id } "not found"

Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}
Expand Down
Loading