Skip to content

Commit 16020ad

Browse files
authored
Merge pull request #7229 from demyanenko/resourcegraph-ps
Initial preview release of ResourceGraph module
2 parents 55c6002 + 1244941 commit 16020ad

34 files changed

+2325
-0
lines changed

Azure.PowerShell.Netcore.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StaticAnalysis.Netcore", "t
140140
EndProject
141141
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.RedisCache.Netcore", "src\ResourceManager\RedisCache\Commands.RedisCache\Commands.RedisCache.Netcore.csproj", "{06B4370D-D375-482C-AD23-CFDAC0176147}"
142142
EndProject
143+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.ResourceGraph.Netcore", "src\ResourceManager\ResourceGraph\Commands.ResourceGraph\Commands.ResourceGraph.Netcore.csproj", "{7254D970-9EEF-4DF1-958F-51003F46736E}"
144+
EndProject
143145
Global
144146
GlobalSection(SolutionConfigurationPlatforms) = preSolution
145147
Debug|Any CPU = Debug|Any CPU
@@ -977,6 +979,18 @@ Global
977979
{06B4370D-D375-482C-AD23-CFDAC0176147}.Release|x64.ActiveCfg = Release|Any CPU
978980
{06B4370D-D375-482C-AD23-CFDAC0176147}.Release|x64.Build.0 = Release|Any CPU
979981
{06B4370D-D375-482C-AD23-CFDAC0176147}.Release|x86.ActiveCfg = Release|Any CPU
982+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
983+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Debug|Any CPU.Build.0 = Debug|Any CPU
984+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Debug|x64.ActiveCfg = Debug|Any CPU
985+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Debug|x64.Build.0 = Debug|Any CPU
986+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Debug|x86.ActiveCfg = Debug|Any CPU
987+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Debug|x86.Build.0 = Debug|Any CPU
988+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Release|Any CPU.ActiveCfg = Release|Any CPU
989+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Release|Any CPU.Build.0 = Release|Any CPU
990+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Release|x64.ActiveCfg = Release|Any CPU
991+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Release|x64.Build.0 = Release|Any CPU
992+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Release|x86.ActiveCfg = Release|Any CPU
993+
{7254D970-9EEF-4DF1-958F-51003F46736E}.Release|x86.Build.0 = Release|Any CPU
980994
EndGlobalSection
981995
GlobalSection(SolutionProperties) = preSolution
982996
HideSolutionNode = FALSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="$(ProjectDir)..\..\..\..\tools\Common.Netcore.Dependencies.Test.targets" />
4+
5+
<PropertyGroup>
6+
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0;net472</TargetFrameworks>
7+
<AssemblyName>Microsoft.Azure.Commands.ResourceGraph.Test</AssemblyName>
8+
<RootNamespace>Microsoft.Azure.Commands.ResourceGraph.Test</RootNamespace>
9+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
10+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
11+
<WarningsAsErrors />
12+
</PropertyGroup>
13+
14+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
15+
<DelaySign>false</DelaySign>
16+
<DefineConstants>TRACE;DEBUG;NETSTANDARD</DefineConstants>
17+
</PropertyGroup>
18+
19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
20+
<SignAssembly>true</SignAssembly>
21+
<DelaySign>true</DelaySign>
22+
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
23+
<DefineConstants>TRACE;RELEASE;NETSTANDARD;SIGN</DefineConstants>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<PackageReference Include="Microsoft.Azure.Management.ResourceGraph" Version="0.9.0-preview" />
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<None Update="SessionRecords\**\*.json">
32+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
33+
</None>
34+
<None Update="ScenarioTests\*.ps1">
35+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
36+
</None>
37+
</ItemGroup>
38+
39+
</Project>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\..\..\..\tools\Common.Dependencies.Test.targets" />
4+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
5+
<PropertyGroup>
6+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8+
<ProjectGuid>{E628DC38-C7DE-4E2B-B9DF-36D0940EE6BA}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>Microsoft.Azure.Commands.ResourceGraph.Test</RootNamespace>
12+
<AssemblyName>Microsoft.Azure.Commands.ResourceGraph.Test</AssemblyName>
13+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
16+
<RestorePackages>true</RestorePackages>
17+
<TargetFrameworkProfile />
18+
<NuGetPackageImportStamp>
19+
</NuGetPackageImportStamp>
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22+
<DebugSymbols>true</DebugSymbols>
23+
<DebugType>full</DebugType>
24+
<Optimize>false</Optimize>
25+
<OutputPath>bin\Debug\</OutputPath>
26+
<DefineConstants>DEBUG;TRACE</DefineConstants>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
</PropertyGroup>
30+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE;SIGN</DefineConstants>
33+
<Optimize>true</Optimize>
34+
<DebugType>pdbonly</DebugType>
35+
<PlatformTarget>AnyCPU</PlatformTarget>
36+
<ErrorReport>prompt</ErrorReport>
37+
<RunCodeAnalysis>false</RunCodeAnalysis>
38+
<SignAssembly>true</SignAssembly>
39+
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
40+
<DelaySign>true</DelaySign>
41+
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
42+
</PropertyGroup>
43+
<ItemGroup>
44+
<Reference Include="Microsoft.Azure.Management.ResourceGraph, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
45+
<SpecificVersion>False</SpecificVersion>
46+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceGraph.0.9.0-preview\lib\net452\Microsoft.Azure.Management.ResourceGraph.dll</HintPath>
47+
<Private>True</Private>
48+
</Reference>
49+
</ItemGroup>
50+
<ItemGroup>
51+
<Compile Include="Properties\AssemblyInfo.cs" />
52+
<Compile Include="ScenarioTests\ResourceGraphQueryTests.cs" />
53+
<Compile Include="ScenarioTests\TestController.cs" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<ProjectReference Include="..\Commands.ResourceGraph\Commands.ResourceGraph.csproj">
57+
<Project>{cdfd4e1b-bb5f-439b-8843-e6127cd9b8ad}</Project>
58+
<Name>Commands.ResourceGraph</Name>
59+
</ProjectReference>
60+
</ItemGroup>
61+
<ItemGroup>
62+
<None Include="MSSharedLibKey.snk" />
63+
<None Include="packages.config">
64+
<SubType>Designer</SubType>
65+
</None>
66+
<None Include="ScenarioTests\Common.ps1">
67+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
68+
</None>
69+
<None Include="ScenarioTests\ResourceGraphQueryTests.ps1">
70+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
71+
</None>
72+
<None Include="SessionRecords\Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests\PagedQuery.json">
73+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
74+
</None>
75+
<None Include="SessionRecords\Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests\Query.json">
76+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
77+
</None>
78+
<None Include="SessionRecords\Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests\QueryError.json">
79+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
80+
</None>
81+
<None Include="SessionRecords\Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests.ResourceGraphQueryTests\Subscriptions.json">
82+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
83+
</None>
84+
</ItemGroup>
85+
<ItemGroup>
86+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
87+
</ItemGroup>
88+
<ItemGroup />
89+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
90+
</Project>
Binary file not shown.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Reflection;
17+
using System.Runtime.InteropServices;
18+
using Xunit;
19+
20+
[assembly: AssemblyTitle("Microsoft Azure Powershell - Resource Graph Tests")]
21+
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
22+
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
23+
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
24+
25+
[assembly: ComVisible(false)]
26+
[assembly: CLSCompliant(false)]
27+
[assembly: Guid("D068E49B-01B0-4CBB-807E-82C78983019E")]
28+
29+
[assembly: AssemblyVersion("0.9.0")]
30+
[assembly: AssemblyFileVersion("0.9.0")]
31+
32+
[assembly: CollectionBehavior(DisableTestParallelization = true)]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
Validates a string is not null or empty
18+
#>
19+
function Assert-NotNullOrEmpty
20+
{
21+
param([string]$value)
22+
23+
Assert-False { [string]::IsNullOrEmpty($value) }
24+
}
25+
26+
<#
27+
.SYNOPSIS
28+
Validates an object is instance of a type
29+
#>
30+
function Assert-IsInstance
31+
{
32+
param([object] $obj, [Type] $type)
33+
34+
Assert-AreEqual $obj.GetType() $type
35+
}
36+
37+
<#
38+
.SYNOPSIS
39+
Validates property count of a custom object
40+
#>
41+
function Assert-PropertiesCount
42+
{
43+
param([PSCustomObject] $obj, [int] $count)
44+
45+
$properties = $obj.PSObject.Properties
46+
Assert-AreEqual $([System.Linq.Enumerable]::ToArray($properties).Count) $count
47+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.ScenarioTest;
16+
using Microsoft.Azure.ServiceManagemenet.Common.Models;
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Xunit;
19+
20+
namespace Microsoft.Azure.Commands.ResourceGraph.Test.ScenarioTests
21+
{
22+
public class ResourceGraphQueryTests
23+
{
24+
private readonly XunitTracingInterceptor _logger;
25+
26+
public ResourceGraphQueryTests(Xunit.Abstractions.ITestOutputHelper output)
27+
{
28+
_logger = new XunitTracingInterceptor(output);
29+
XunitTracingInterceptor.AddToContext(_logger);
30+
TestExecutionHelpers.SetUpSessionAndProfile();
31+
}
32+
33+
[Fact]
34+
[Trait(Category.AcceptanceType, Category.CheckIn)]
35+
public void Query()
36+
{
37+
TestController.NewInstance.RunPowerShellTest(_logger, "Search-AzureRmGraph-Query");
38+
}
39+
40+
[Fact]
41+
[Trait(Category.AcceptanceType, Category.CheckIn)]
42+
public void PagedQuery()
43+
{
44+
TestController.NewInstance.RunPowerShellTest(_logger, "Search-AzureRmGraph-PagedQuery");
45+
}
46+
47+
[Fact]
48+
[Trait(Category.AcceptanceType, Category.CheckIn)]
49+
public void Subscriptions()
50+
{
51+
TestController.NewInstance.RunPowerShellTest(_logger, "Search-AzureRmGraph-Subscriptions");
52+
}
53+
54+
[Fact]
55+
[Trait(Category.AcceptanceType, Category.CheckIn)]
56+
public void QueryError()
57+
{
58+
TestController.NewInstance.RunPowerShellTest(_logger, "Search-AzureRmGraph-QueryError");
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)