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
7 changes: 7 additions & 0 deletions src/SDKs/LabServices/AzSdk.RP.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file-->
<PropertyGroup>
<AzureApiTag>LabServices_2018-10-15;</AzureApiTag>
<PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags>
</PropertyGroup>
</Project>
23 changes: 23 additions & 0 deletions src/SDKs/LabServices/LabServices.Tests/LabServices.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<Import Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.test.reference.props'))" />
<PropertyGroup>
<Description>LabServices.Tests Class Library</Description>
<PackageId>LabServices.Tests</PackageId>
<AssemblyName>LabServices.Tests</AssemblyName>
<Version>1.0.0</Version>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Management.LabServices\Microsoft.Azure.Management.LabServices.csproj" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
</ItemGroup>
<ItemGroup>
<None Update="SessionRecords\**\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<!--DO NOT Remove until a bug in VS Test Tools is fixed-->
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions src/SDKs/LabServices/LabServices.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System.Reflection;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LabServices.")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("LabServices.Tests")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"Entries": [
{
"RequestUri": "/subscriptions/33855c90-c8cf-44a0-a266-9b548fb8e7b0/providers/Microsoft.LabServices/labaccounts?api-version=2018-10-15",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
"x-ms-client-request-id": [
"2de605b0-19a2-481e-af6b-0da68dd0dac7"
],
"accept-language": [
"en-US"
],
"User-Agent": [
"Microsoft.Azure.Management.LabServices.ManagedLabsClient/1.0.0.0"
]
},
"ResponseBody": "{\"value\":[{\"properties\":{\"sizeConfiguration\":{\"environmentSizes\":[{\"name\":\"Basic\",\"vmSizes\":[{\"computeSize\":\"Standard_A2_v2\",\"price\":0.1,\"numberOfCores\":2,\"memory\":4.0},{\"computeSize\":\"Standard_A2\",\"price\":0.1,\"numberOfCores\":2,\"memory\":3.5}],\"maxPrice\":0.1,\"minNumberOfCores\":2,\"minMemory\":3.5},{\"name\":\"Standard\",\"vmSizes\":[{\"computeSize\":\"Standard_A4_v2\",\"price\":0.21,\"numberOfCores\":4,\"memory\":8.0},{\"computeSize\":\"Standard_A3\",\"price\":0.21,\"numberOfCores\":4,\"memory\":7.0}],\"maxPrice\":0.21,\"minNumberOfCores\":4,\"minMemory\":7.0},{\"name\":\"Performance\",\"vmSizes\":[{\"computeSize\":\"Standard_D8s_v3\",\"price\":0.42,\"numberOfCores\":8,\"memory\":32.0}],\"maxPrice\":0.42,\"minNumberOfCores\":8,\"minMemory\":32.0}]},\"enabledRegionSelection\":false,\"provisioningState\":\"Succeeded\",\"uniqueIdentifier\":\"70223f58-e5ab-4bc7-a224-c6a4a7309204\",\"latestOperationResult\":{}},\"id\":\"/subscriptions/33855c90-c8cf-44a0-a266-9b548fb8e7b0/resourcegroups/mlmonitor/providers/microsoft.labservices/labaccounts/mlmonitor-lab-eastus2\",\"name\":\"mlmonitor-lab-eastus2\",\"type\":\"Microsoft.LabServices/labAccounts\",\"location\":\"westus2\"}]}",
"ResponseHeaders": {
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Thu, 13 Dec 2018 18:35:15 GMT"
],
"Pragma": [
"no-cache"
],
"Vary": [
"Accept-Encoding"
],
"x-ms-original-request-ids": [
"",
""
],
"x-ms-ratelimit-remaining-subscription-reads": [
"11999"
],
"x-ms-request-id": [
"613f60e1-fc98-4759-946b-ca0ec1435d14"
],
"x-ms-correlation-request-id": [
"613f60e1-fc98-4759-946b-ca0ec1435d14"
],
"x-ms-routing-request-id": [
"WESTUS2:20181213T183515Z:613f60e1-fc98-4759-946b-ca0ec1435d14"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
]
},
"StatusCode": 200
}
],
"Names": {},
"Variables": {
"SubscriptionId": "33855c90-c8cf-44a0-a266-9b548fb8e7b0"
}
}
25 changes: 25 additions & 0 deletions src/SDKs/LabServices/LabServices.Tests/Tests/BasicTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using Microsoft.Azure.Management.LabServices;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using System.Linq;
using Xunit;

namespace LabServices.Tests
{
public class LabTests : LabServicesTestBase
{
[Fact]
public void ListLabsTest()
{
using (MockContext context = MockContext.Start(this.GetType().FullName))
{
ManagedLabsClient client = GetManagedLabsClient(context);

var labs = client.LabAccounts.ListBySubscription().ToList();
Assert.NotEmpty(labs);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using Microsoft.Azure.Management.LabServices;
using Microsoft.Azure.Management.LabServices.Models;
using Microsoft.Azure.Test.HttpRecorder;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using System;
using System.Linq;
using System.Threading;

namespace LabServices.Tests
{
public class TestEnvironmentInfo
{
public TestEnvironmentInfo()
{
}

public TestEnvironmentInfo(string s)
{
SubscriptionId = s;
}

public string SubscriptionId { get; set; }
}

public class LabServicesTestBase : TestBase
{
public const string SubscriptionIdKey = "SubscriptionId";

public TestEnvironmentInfo GetEnvironmentInfo()
{
SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
TestEnvironmentInfo result = new TestEnvironmentInfo();
if (HttpMockServer.Mode == HttpRecorderMode.Record)
{
var environment = TestEnvironmentFactory.GetTestEnvironment();
result.SubscriptionId = environment.SubscriptionId;

HttpMockServer.Variables[SubscriptionIdKey] = result.SubscriptionId;
}
else if (HttpMockServer.Mode == HttpRecorderMode.Playback)
{
result.SubscriptionId = HttpMockServer.Variables[SubscriptionIdKey];
}
return result;
}

public ManagedLabsClient GetManagedLabsClient(MockContext context)
{
var client = context.GetServiceClient<ManagedLabsClient>();

client.SubscriptionId = GetEnvironmentInfo().SubscriptionId;

return client;
}

public Lab CreateKeyCredential()
{
var lab = new Lab
{
Location = "westus",
};

return lab;
}
}
}
31 changes: 31 additions & 0 deletions src/SDKs/LabServices/LabServices.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.LabServices", "Management.LabServices\Microsoft.Azure.Management.LabServices.csproj", "{B2143F8C-A1B8-4042-ACAB-CB7797E24C9F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LabServices.Tests", "LabServices.Tests\LabServices.Tests.csproj", "{DC1024AF-4E20-4E65-9ED8-09CC26385B8B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B2143F8C-A1B8-4042-ACAB-CB7797E24C9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2143F8C-A1B8-4042-ACAB-CB7797E24C9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2143F8C-A1B8-4042-ACAB-CB7797E24C9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2143F8C-A1B8-4042-ACAB-CB7797E24C9F}.Release|Any CPU.Build.0 = Release|Any CPU
{DC1024AF-4E20-4E65-9ED8-09CC26385B8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC1024AF-4E20-4E65-9ED8-09CC26385B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC1024AF-4E20-4E65-9ED8-09CC26385B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC1024AF-4E20-4E65-9ED8-09CC26385B8B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4429D4FA-7D6F-4CB8-8D6C-355D4CFDCD6F}
EndGlobalSection
EndGlobal
Loading