-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Azure Stack Admin for Commerce, Fabric, and InfrastructureInsights #3649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
581677b
Azure Stack Admin for Commerce, Fabric, and InfrastructureInsights
b89cdd7
Moved AzureStack directory, re-recorded tests
c9019d3
Fixed generation script
e03e682
Fixed bug in Commerce Tests
80930bb
Merged and updated admin rp generate.cmd files
2c4c265
Remove changes under SDKs
e898de1
Changed casing so that linux build works
d94dee0
Updated Commerce Tests and Recorded new Data
5de68f8
Merge branch 'psSdkJson6' of https://github.com/deathly809/azure-sdk-…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <Import Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.props'))" /> | ||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="[3.3.9, 4.0.0)" /> | ||
| <PackageReference Include="Microsoft.Rest.ClientRuntime" Version="[2.3.9, 3.0.0)" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.4' "> | ||
| <PackageReference Include="System.Net.Http" Version="4.3.0"/> | ||
| <PackageReference Include="Newtonsoft.Json" Version="9.0.1" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition=" '$(TargetFramework)' == 'net452' "> | ||
| <Reference Include="System.Net" /> | ||
| <Reference Include="System.Net.Http" /> | ||
| <PackageReference Include="Newtonsoft.Json" Version="6.0.8" /> | ||
| </ItemGroup> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <Import Project="$([MSBuild]::GetPathOfFileAbove('test.props'))" /> | ||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.Azure.Test.HttpRecorder" Version="[1.8.1,2.0.0)" /> | ||
| <PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework" Version="[1.7.1,2.0.0)" /> | ||
| <PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="[3.3.9, 4.0.0)" /> | ||
| <PackageReference Include="Microsoft.Azure.ResourceManager" Version="[1.1.0-preview]" /> | ||
|
|
||
| <!-- This is needed for discovering tests in test explorer --> | ||
| <PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" /> | ||
| </ItemGroup> | ||
| </Project> |
28 changes: 28 additions & 0 deletions
28
src/AzureStack/CommerceAdmin/Commerce.Admin.Tests/Commerce.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <Import Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.test.reference.props'))" /> | ||
| <PropertyGroup> | ||
| <PackageId>Commerce.Admin.Tests</PackageId> | ||
| <Description>Commerce.Admin.Tests Class Library</Description> | ||
| <AssemblyName>Commerce.Admin.Tests</AssemblyName> | ||
| <VersionPrefix>1.0.0-preview</VersionPrefix> | ||
| </PropertyGroup> | ||
| <PropertyGroup> | ||
| <TargetFrameworks>netcoreapp1.1</TargetFrameworks> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\SDKCommon\TestCommon\TestCommon.csproj" /> | ||
| <ProjectReference Include="..\Commerce.Admin\Microsoft.AzureStack.Management.Commerce.Admin.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Update="SessionRecords\**\*.json"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| </None> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
20 changes: 20 additions & 0 deletions
20
src/AzureStack/CommerceAdmin/Commerce.Admin.Tests/Properties/AssemblyInfo.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using System.Reflection; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| [assembly: AssemblyTitle("Commerce.Tests")] | ||
| [assembly: AssemblyDescription("")] | ||
| [assembly: AssemblyConfiguration("")] | ||
| [assembly: AssemblyCompany("Microsoft")] | ||
| [assembly: AssemblyProduct("Commerce.Tests")] | ||
| [assembly: AssemblyCopyright("Copyright © Microsoft 2017")] | ||
| [assembly: AssemblyTrademark("")] | ||
| [assembly: AssemblyCulture("")] | ||
|
|
||
| [assembly: ComVisible(false)] | ||
|
|
||
| [assembly: Guid("1b24bc4a-6e4d-4feb-b5d5-c9684c60a308")] | ||
|
|
||
| // [assembly: AssemblyVersion("1.0.*")] | ||
| [assembly: AssemblyVersion("1.0.0.0")] | ||
| [assembly: AssemblyFileVersion("1.0.0.0")] |
69 changes: 69 additions & 0 deletions
69
.../SessionRecords/CommerceAdminClient/TestListSubscriberUsageAggregatesFromLastTwoDays.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| { | ||
| "Entries": [ | ||
| { | ||
| "RequestUri": "/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/subscriberUsageAggregates?api-version=2015-06-01-preview&reportedStartTime=2017-09-06T00:00:00Z&reportedEndTime=2017-09-07T00:00:00Z", | ||
| "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMWMwZGFhMDQtMDFhZS00ZGY5LWE1ZDgtNDkxYjc1NWY1Mjg4L3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29tbWVyY2Uvc3Vic2NyaWJlclVzYWdlQWdncmVnYXRlcz9hcGktdmVyc2lvbj0yMDE1LTA2LTAxLXByZXZpZXcmcmVwb3J0ZWRTdGFydFRpbWU9MjAxNy0wOS0wNlQwMCUzQTAwJTNBMDBaJnJlcG9ydGVkRW5kVGltZT0yMDE3LTA5LTA3VDAwJTNBMDAlM0EwMFo=", | ||
| "RequestMethod": "GET", | ||
| "RequestBody": "", | ||
| "RequestHeaders": { | ||
| "x-ms-client-request-id": [ | ||
| "a4a62639-68fa-4fe3-85ea-8d2eb24cad12" | ||
| ], | ||
| "accept-language": [ | ||
| "en-US" | ||
| ], | ||
| "User-Agent": [ | ||
| "FxVersion/4.6.25211.01", | ||
| "Microsoft.AzureStack.Management.Commerce.Admin.CommerceAdminClient/0.1.0.0" | ||
| ] | ||
| }, | ||
| "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/UsageAggregate/36770ead-1c95-4048-8ff3-d727dd5007de-9764F92C-E44A-498E-8DC1-AAD66587A810\",\r\n \"name\": \"36770ead-1c95-4048-8ff3-d727dd5007de-9764F92C-E44A-498E-8DC1-AAD66587A810\",\r\n \"type\": \"Microsoft.Commerce/UsageAggregate\",\r\n \"properties\": {\r\n \"subscriptionId\": \"36770ead-1c95-4048-8ff3-d727dd5007de\",\r\n \"usageStartTime\": \"2017-09-05T17:00:00-07:00\",\r\n \"usageEndTime\": \"2017-09-06T17:00:00-07:00\",\r\n \"instanceData\": \"{\\\"Microsoft.Resources\\\":{\\\"resourceUri\\\":\\\"/subscriptions/36770ead-1c95-4048-8ff3-d727dd5007de/resourcegroups/derpgroup/providers/Microsoft.Storage/storageaccounts/vmefbj65\\\",\\\"location\\\":\\\"local\\\",\\\"tags\\\":null,\\\"additionalInfo\\\":null}}\",\r\n \"quantity\": 0.0029740091413259506,\r\n \"meterId\": \"9764F92C-E44A-498E-8DC1-AAD66587A810\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/UsageAggregate/36770ead-1c95-4048-8ff3-d727dd5007de-43DAF82B-4618-444A-B994-40C23F7CD438\",\r\n \"name\": \"36770ead-1c95-4048-8ff3-d727dd5007de-43DAF82B-4618-444A-B994-40C23F7CD438\",\r\n \"type\": \"Microsoft.Commerce/UsageAggregate\",\r\n \"properties\": {\r\n \"subscriptionId\": \"36770ead-1c95-4048-8ff3-d727dd5007de\",\r\n \"usageStartTime\": \"2017-09-05T17:00:00-07:00\",\r\n \"usageEndTime\": \"2017-09-06T17:00:00-07:00\",\r\n \"instanceData\": \"{\\\"Microsoft.Resources\\\":{\\\"resourceUri\\\":\\\"/subscriptions/36770ead-1c95-4048-8ff3-d727dd5007de/resourcegroups/derpgroup/providers/Microsoft.Storage/storageaccounts/vmefbj65\\\",\\\"location\\\":\\\"local\\\",\\\"tags\\\":null,\\\"additionalInfo\\\":null}}\",\r\n \"quantity\": 0.051000000000000004,\r\n \"meterId\": \"43DAF82B-4618-444A-B994-40C23F7CD438\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/UsageAggregate/36770ead-1c95-4048-8ff3-d727dd5007de-6dab500f-a4fd-49c4-956d-229bb9c8c793\",\r\n \"name\": \"36770ead-1c95-4048-8ff3-d727dd5007de-6dab500f-a4fd-49c4-956d-229bb9c8c793\",\r\n \"type\": \"Microsoft.Commerce/UsageAggregate\",\r\n \"properties\": {\r\n \"subscriptionId\": \"36770ead-1c95-4048-8ff3-d727dd5007de\",\r\n \"usageStartTime\": \"2017-09-05T17:00:00-07:00\",\r\n \"usageEndTime\": \"2017-09-06T17:00:00-07:00\",\r\n \"instanceData\": \"{\\\"Microsoft.Resources\\\":{\\\"resourceUri\\\":\\\"/subscriptions/36770ead-1c95-4048-8ff3-d727dd5007de/resourceGroups/derpgroup/providers/Microsoft.Compute/virtualMachines/simplewinvmd\\\",\\\"location\\\":\\\"local\\\",\\\"tags\\\":\\\"null\\\",\\\"additionalInfo\\\":\\\"{\\\\\\\"ServiceType\\\\\\\":\\\\\\\"Standard_A1\\\\\\\",\\\\\\\"ImageType\\\\\\\":null}\\\"}}\",\r\n \"quantity\": 3.9998271341111109,\r\n \"meterId\": \"6dab500f-a4fd-49c4-956d-229bb9c8c793\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/UsageAggregate/36770ead-1c95-4048-8ff3-d727dd5007de-9cd92d4c-bafd-4492-b278-bedc2de8232a\",\r\n \"name\": \"36770ead-1c95-4048-8ff3-d727dd5007de-9cd92d4c-bafd-4492-b278-bedc2de8232a\",\r\n \"type\": \"Microsoft.Commerce/UsageAggregate\",\r\n \"properties\": {\r\n \"subscriptionId\": \"36770ead-1c95-4048-8ff3-d727dd5007de\",\r\n \"usageStartTime\": \"2017-09-05T17:00:00-07:00\",\r\n \"usageEndTime\": \"2017-09-06T17:00:00-07:00\",\r\n \"instanceData\": \"{\\\"Microsoft.Resources\\\":{\\\"resourceUri\\\":\\\"/subscriptions/36770ead-1c95-4048-8ff3-d727dd5007de/resourceGroups/derpgroup/providers/Microsoft.Compute/virtualMachines/simplewinvmd\\\",\\\"location\\\":\\\"local\\\",\\\"tags\\\":\\\"null\\\",\\\"additionalInfo\\\":\\\"{\\\\\\\"ServiceType\\\\\\\":\\\\\\\"Standard_A1\\\\\\\",\\\\\\\"ImageType\\\\\\\":null}\\\"}}\",\r\n \"quantity\": 3.9998271341111109,\r\n \"meterId\": \"9cd92d4c-bafd-4492-b278-bedc2de8232a\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/UsageAggregate/36770ead-1c95-4048-8ff3-d727dd5007de-B5C15376-6C94-4FDD-B655-1A69D138ACA3\",\r\n \"name\": \"36770ead-1c95-4048-8ff3-d727dd5007de-B5C15376-6C94-4FDD-B655-1A69D138ACA3\",\r\n \"type\": \"Microsoft.Commerce/UsageAggregate\",\r\n \"properties\": {\r\n \"subscriptionId\": \"36770ead-1c95-4048-8ff3-d727dd5007de\",\r\n \"usageStartTime\": \"2017-09-05T17:00:00-07:00\",\r\n \"usageEndTime\": \"2017-09-06T17:00:00-07:00\",\r\n \"instanceData\": \"{\\\"Microsoft.Resources\\\":{\\\"resourceUri\\\":\\\"/subscriptions/36770ead-1c95-4048-8ff3-d727dd5007de/resourcegroups/derpgroup/providers/Microsoft.Storage/storageaccounts/vmefbj65\\\",\\\"location\\\":\\\"local\\\",\\\"tags\\\":null,\\\"additionalInfo\\\":null}}\",\r\n \"quantity\": 47.745195036754012,\r\n \"meterId\": \"B5C15376-6C94-4FDD-B655-1A69D138ACA3\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/UsageAggregate/36770ead-1c95-4048-8ff3-d727dd5007de-09F8879E-87E9-4305-A572-4B7BE209F857\",\r\n \"name\": \"36770ead-1c95-4048-8ff3-d727dd5007de-09F8879E-87E9-4305-A572-4B7BE209F857\",\r\n \"type\": \"Microsoft.Commerce/UsageAggregate\",\r\n \"properties\": {\r\n \"subscriptionId\": \"36770ead-1c95-4048-8ff3-d727dd5007de\",\r\n \"usageStartTime\": \"2017-09-05T17:00:00-07:00\",\r\n \"usageEndTime\": \"2017-09-06T17:00:00-07:00\",\r\n \"instanceData\": \"{\\\"Microsoft.Resources\\\":{\\\"resourceUri\\\":\\\"/subscriptions/36770ead-1c95-4048-8ff3-d727dd5007de/resourcegroups/derpgroup/providers/Microsoft.Storage/storageaccounts/vmefbj65\\\",\\\"location\\\":\\\"local\\\",\\\"tags\\\":null,\\\"additionalInfo\\\":null}}\",\r\n \"quantity\": 6.866455078125E-05,\r\n \"meterId\": \"09F8879E-87E9-4305-A572-4B7BE209F857\"\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/UsageAggregate/36770ead-1c95-4048-8ff3-d727dd5007de-3023FEF4-ECA5-4D7B-87B3-CFBC061931E8\",\r\n \"name\": \"36770ead-1c95-4048-8ff3-d727dd5007de-3023FEF4-ECA5-4D7B-87B3-CFBC061931E8\",\r\n \"type\": \"Microsoft.Commerce/UsageAggregate\",\r\n \"properties\": {\r\n \"subscriptionId\": \"36770ead-1c95-4048-8ff3-d727dd5007de\",\r\n \"usageStartTime\": \"2017-09-05T17:00:00-07:00\",\r\n \"usageEndTime\": \"2017-09-06T17:00:00-07:00\",\r\n \"instanceData\": \"{\\\"Microsoft.Resources\\\":{\\\"resourceUri\\\":\\\"/subscriptions/36770ead-1c95-4048-8ff3-d727dd5007de/resourcegroups/derpgroup/providers/Microsoft.Storage/storageaccounts/vmefbj65\\\",\\\"location\\\":\\\"local\\\",\\\"tags\\\":null,\\\"additionalInfo\\\":null}}\",\r\n \"quantity\": 0.00011140573769807816,\r\n \"meterId\": \"3023FEF4-ECA5-4D7B-87B3-CFBC061931E8\"\r\n }\r\n }\r\n ],\r\n \"nextLink\": \"https://adminmanagement.local.azurestack.external/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/subscriberUsageAggregates?api-version=2015-06-01-preview&reportedStartTime=2017-09-06T00:00:00Z&reportedEndTime=2017-09-07T00:00:00Z/subscriptions/1c0daa04-01ae-4df9-a5d8-491b755f5288/providers/Microsoft.Commerce/subscriberUsageAggregates?api-version=2015-06-01-preview&reportedStartTime=2017-09-06T00%3a00%3a00Z&reportedEndTime=2017-09-07T00%3a00%3a00Z&continuationToken=L3N1YnNjcmlwdGlvbnMvMzY3NzBlYWQtMWM5NS00MDQ4LThmZjMtZDcyN2RkNTAwN2RlL3Jlc291cmNlZ3JvdXBzL2RlcnBncm91cC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZWFjY291bnRzL3ZtZWZiajY1LzMwMjNGRUY0LUVDQTUtNEQ3Qi04N0IzLUNGQkMwNjE5MzFFOC82MzY0MDI1MjgwMDAwMDAwMDAvNjM2NDAyNTI4MDAwMDAwMDAw\"\r\n}", | ||
| "ResponseHeaders": { | ||
| "Content-Length": [ | ||
| "6545" | ||
| ], | ||
| "Content-Type": [ | ||
| "application/json; charset=utf-8" | ||
| ], | ||
| "Expires": [ | ||
| "-1" | ||
| ], | ||
| "Cache-Control": [ | ||
| "no-cache" | ||
| ], | ||
| "Date": [ | ||
| "Wed, 06 Sep 2017 22:13:35 GMT" | ||
| ], | ||
| "Pragma": [ | ||
| "no-cache" | ||
| ], | ||
| "X-Powered-By": [ | ||
| "ASP.NET" | ||
| ], | ||
| "x-ms-ratelimit-remaining-subscription-reads": [ | ||
| "14761" | ||
| ], | ||
| "x-ms-request-id": [ | ||
| "d2a24d60-7347-4c54-bb58-1eb04c398e56" | ||
| ], | ||
| "x-ms-correlation-request-id": [ | ||
| "d2a24d60-7347-4c54-bb58-1eb04c398e56" | ||
| ], | ||
| "x-ms-routing-request-id": [ | ||
| "LOCAL:20170906T221336Z:d2a24d60-7347-4c54-bb58-1eb04c398e56" | ||
| ], | ||
| "Strict-Transport-Security": [ | ||
| "max-age=31536000; includeSubDomains" | ||
| ], | ||
| "X-Content-Type-Options": [ | ||
| "nosniff" | ||
| ] | ||
| }, | ||
| "StatusCode": 200 | ||
| } | ||
| ], | ||
| "Names": {}, | ||
| "Variables": { | ||
| "SubscriptionId": "1c0daa04-01ae-4df9-a5d8-491b755f5288" | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
src/AzureStack/CommerceAdmin/Commerce.Admin.Tests/src/CommerceTestBase.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| | ||
| using Microsoft.AzureStack.Management.Commerce.Admin; | ||
| using Microsoft.AzureStack.TestFramework; | ||
| using Xunit; | ||
|
|
||
| namespace Commerce.Tests | ||
| { | ||
|
|
||
| public class CommerceTestBase : TestBase<CommerceAdminClient> | ||
| { | ||
| public CommerceTestBase() | ||
| { | ||
| // Empty | ||
| } | ||
|
|
||
| protected override void ValidateClient(CommerceAdminClient client) | ||
| { | ||
| // validate creation | ||
| Assert.NotNull(client); | ||
|
|
||
| // validate objects | ||
| Assert.NotNull(client.SubscriberUsageAggregates); | ||
| Assert.NotNull(client.SubscriptionId); | ||
| } | ||
| } | ||
| } |
59 changes: 59 additions & 0 deletions
59
src/AzureStack/CommerceAdmin/Commerce.Admin.Tests/src/SubscriberUsageAggregateTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| | ||
| using System; | ||
| using Xunit; | ||
|
|
||
| using Microsoft.AzureStack.Management.Commerce.Admin; | ||
| using Microsoft.AzureStack.Management.Commerce.Admin.Models; | ||
|
|
||
| using Microsoft.AzureStack.TestFramework; | ||
|
|
||
| namespace Commerce.Tests | ||
| { | ||
| public class SubscriberUsageAggregateTests : CommerceTestBase | ||
| { | ||
|
|
||
| private void ValidateUsageAggregate(UsageAggregate ua) { | ||
| Assert.NotNull(ua); | ||
| Assert.NotNull(ua.Id); | ||
| Assert.NotNull(ua.InstanceData); | ||
| Assert.NotNull(ua.MeterId); | ||
| Assert.NotNull(ua.Name); | ||
| Assert.NotNull(ua.Quantity); | ||
| Assert.NotNull(ua.SubscriptionId); | ||
| Assert.NotNull(ua.Type); | ||
| Assert.NotNull(ua.UsageEndTime); | ||
| Assert.NotNull(ua.UsageStartTime); | ||
| } | ||
|
|
||
| private void AssertDateIsDayOnly(DateTime time, string msg = null) { | ||
| msg = $"{msg} : " ?? ""; | ||
| Assert.Equal(0, time.Hour); | ||
| Assert.Equal(0, time.Minute); | ||
| Assert.Equal(0, time.Second); | ||
| Assert.Equal(0, time.Millisecond); | ||
|
|
||
| } | ||
|
|
||
| [Fact] | ||
| public void TestListSubscriberUsageAggregatesFromLastTwoDays() { | ||
| RunTest((client) => { | ||
| var testDate = new DateTime(2017,09,06); | ||
| testDate = DateTime.SpecifyKind(testDate, DateTimeKind.Utc); | ||
| var start = testDate.Floor(); | ||
| var end = start.AddDays(1).Floor(); | ||
|
|
||
| // You need to do this. ARM does this and you need to make | ||
| // sure you work with ARM. | ||
| AssertDateIsDayOnly(start, "start"); | ||
| AssertDateIsDayOnly(end, "end"); | ||
|
|
||
|
|
||
| var subscriberUsageAggregates = client.SubscriberUsageAggregates.List(start, end); | ||
| Assert.NotNull(subscriberUsageAggregates); | ||
| Assert.NotNull(subscriberUsageAggregates.Value); | ||
| Common.MapOverIEnumerable(subscriberUsageAggregates.Value, (v) => ValidateUsageAggregate(v)); | ||
| }); | ||
| } | ||
|
|
||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deathly809 have this be a nuget dependency instead of a project reference