Skip to content

Commit 22d8cae

Browse files
asarkar84Anirban SarkarVeryEarlysarang-amondikar
authored
Added new cmdlets for BillingAccounts, BillingProfiles, InvoiceSections and updated Invoicing cmdlet (#12289)
* Added new cmdlets for BillingAccounts, BillingProfiles and InvoiceSections. * Update ChangeLog.md * Update ChangeLog.md * Updated help file * Updated invoicing tests * Reverted the version change in psd1 file * Reverted assembly info * Incorporated review comments * Added more tests * fix tests in run mode fix max count return value * Updated the format for billing profile cmdlet * onyl display fields which have values * Upgraded the Billing SDK nuget package and added BillingPeriod and Enrollment account cmdlets, tests * Updated chage logs. * Running tests * check if this fixes CI error * add change log to list removed properties from new Invoice cmdlets * Updated change logs * Fixed CredScan failures for Invoicing tests * Added BreakingChangeIssues.csv file Added BreakingChangeIssues.csv file * Update BreakingChangeIssues.csv Co-authored-by: Anirban Sarkar <[email protected]> Co-authored-by: Yabo Hu <[email protected]> Co-authored-by: sarang-amondikar <[email protected]>
1 parent 9a99d02 commit 22d8cae

File tree

75 files changed

+9246
-1078
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+9246
-1078
lines changed

src/Billing/Billing.Test/Billing.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.Billing" Version="2.1.1-preview" />
14+
<PackageReference Include="Microsoft.Azure.Management.Billing" Version="4.1.0" />
1515
</ItemGroup>
1616

1717
</Project>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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.Billing.Test.ScenarioTests.ScenarioTest;
16+
using Microsoft.Azure.Commands.ScenarioTest;
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Xunit;
19+
20+
namespace Microsoft.Azure.Commands.Billing.Test.ScenarioTests
21+
{
22+
public class BillingAccountsTests
23+
{
24+
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;
25+
26+
public BillingAccountsTests(Xunit.Abstractions.ITestOutputHelper output)
27+
{
28+
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
29+
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
30+
TestExecutionHelpers.SetUpSessionAndProfile();
31+
}
32+
33+
[Fact]
34+
[Trait(Category.AcceptanceType, Category.CheckIn)]
35+
public void TestListBillingAccounts()
36+
{
37+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ListBillingAccounts");
38+
}
39+
40+
[Fact]
41+
[Trait(Category.AcceptanceType, Category.CheckIn)]
42+
public void TestListBillingAccountsWithAddress()
43+
{
44+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ListBillingAccountsWithAddress");
45+
}
46+
47+
[Fact]
48+
[Trait(Category.AcceptanceType, Category.CheckIn)]
49+
public void TestListBillingAccountsWithBillingProfiles()
50+
{
51+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ListBillingAccountsWithBillingProfiles");
52+
}
53+
54+
[Fact]
55+
[Trait(Category.AcceptanceType, Category.CheckIn)]
56+
public void TestListBillingAccountsWithInvoiceSections()
57+
{
58+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ListBillingAccountsWithInvoiceSections");
59+
}
60+
61+
[Fact]
62+
[Trait(Category.AcceptanceType, Category.CheckIn)]
63+
public void TestListBillingEntitiesToCreateSubscription()
64+
{
65+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ListBillingEntitiesToCreateSubscription");
66+
}
67+
68+
[Fact]
69+
[Trait(Category.AcceptanceType, Category.CheckIn)]
70+
public void TestGetBillingAccountWithName()
71+
{
72+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetBillingAccountWithName");
73+
}
74+
75+
[Fact]
76+
[Trait(Category.AcceptanceType, Category.CheckIn)]
77+
public void TestGetBillingAccountWithNames()
78+
{
79+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetBillingAccountWithNames");
80+
}
81+
}
82+
}
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
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+
List billing accounts
18+
#>
19+
function Test-ListBillingAccounts
20+
{
21+
$billingAccounts = Get-AzBillingAccount
22+
23+
Assert-True {$billingAccounts.Count -ge 1}
24+
Assert-NotNull $billingAccounts[0].Name
25+
Assert-NotNull $billingAccounts[0].Id
26+
Assert-NotNull $billingAccounts[0].Type
27+
Assert-NotNull $billingAccounts[0].DisplayName
28+
Assert-NotNull $billingAccounts[0].AgreementType
29+
Assert-Null $billingAccounts[0].SoldTo
30+
Assert-Null $billingAccounts[0].BillingProfiles
31+
}
32+
33+
<#
34+
.SYNOPSIS
35+
List billing accounts with SoldTo Address
36+
#>
37+
function Test-ListBillingAccountsWithAddress
38+
{
39+
$billingAccounts = Get-AzBillingAccount -IncludeAddress
40+
41+
Assert-True {$billingAccounts.Count -ge 1}
42+
Assert-NotNull $billingAccounts[0].Name
43+
Assert-NotNull $billingAccounts[0].Id
44+
Assert-NotNull $billingAccounts[0].Type
45+
Assert-NotNull $billingAccounts[0].DisplayName
46+
Assert-NotNull $billingAccounts[0].AgreementType
47+
Assert-NotNull $billingAccounts[0].SoldTo
48+
Assert-NotNull $billingAccounts[0].SoldTo.Country
49+
Assert-Null $billingAccounts[0].BillingProfiles
50+
}
51+
52+
<#
53+
.SYNOPSIS
54+
List billing accounts with billing profiles
55+
#>
56+
function Test-ListBillingAccountsWithBillingProfiles
57+
{
58+
$billingAccounts = Get-AzBillingAccount -ExpandBillingProfile
59+
60+
Assert-True {$billingAccounts.Count -ge 1}
61+
Assert-NotNull $billingAccounts[0].Name
62+
Assert-NotNull $billingAccounts[0].Id
63+
Assert-NotNull $billingAccounts[0].Type
64+
Assert-NotNull $billingAccounts[0].DisplayName
65+
Assert-NotNull $billingAccounts[0].AgreementType
66+
Assert-NotNull $billingAccounts[0].BillingProfiles
67+
Assert-True {$billingAccounts[0].BillingProfiles.Count -ge 1}
68+
Assert-NotNull $billingAccounts[0].BillingProfiles[0].BillTo
69+
Assert-Null $billingAccounts[0].SoldTo
70+
}
71+
72+
<#
73+
.SYNOPSIS
74+
List billing accounts with invoice sections
75+
#>
76+
function Test-ListBillingAccountsWithInvoiceSections
77+
{
78+
$billingAccounts = Get-AzBillingAccount -ExpandInvoiceSection
79+
80+
Assert-True {$billingAccounts.Count -ge 1}
81+
Assert-NotNull $billingAccounts[0].Name
82+
Assert-NotNull $billingAccounts[0].Id
83+
Assert-NotNull $billingAccounts[0].Type
84+
Assert-NotNull $billingAccounts[0].DisplayName
85+
Assert-NotNull $billingAccounts[0].AgreementType
86+
Assert-NotNull $billingAccounts[0].BillingProfiles
87+
Assert-True {$billingAccounts[0].BillingProfiles.Count -ge 1}
88+
Assert-NotNull $billingAccounts[0].BillingProfiles[0].InvoiceSections
89+
Assert-True {$billingAccounts[0].BillingProfiles[0].InvoiceSections.Count -ge 1}
90+
Assert-Null $billingAccounts[0].SoldTo
91+
}
92+
93+
<#
94+
.SYNOPSIS
95+
Get billing account with specified name
96+
#>
97+
function Test-ListBillingEntitiesToCreateSubscription
98+
{
99+
$sampleBillingAccounts = Get-AzBillingAccount
100+
Assert-True { $sampleBillingAccounts.Count -ge 1 }
101+
102+
$billingEntitiesToCreateSubscription = Get-AzBillingAccount -Name $sampleBillingAccounts[0].Name -ListEntitiesToCreateSubscription
103+
Assert-True { $billingEntitiesToCreateSubscription.Count -ge 1 }
104+
Assert-NotNull $billingEntitiesToCreateSubscription[0].BillingProfileId
105+
Assert-NotNull $billingEntitiesToCreateSubscription[0].BillingProfileDisplayName
106+
Assert-NotNull $billingEntitiesToCreateSubscription[0].BillingProfileStatus
107+
Assert-NotNull $billingEntitiesToCreateSubscription[0].InvoiceSectionId
108+
Assert-NotNull $billingEntitiesToCreateSubscription[0].InvoiceSectionDisplayName
109+
Assert-NotNull $billingEntitiesToCreateSubscription[0].EnabledAzurePlans
110+
}
111+
112+
<#
113+
.SYNOPSIS
114+
Get billing account with specified name
115+
#>
116+
function Test-GetBillingAccountWithName
117+
{
118+
$sampleBillingAccounts = Get-AzBillingAccount
119+
Assert-True { $sampleBillingAccounts.Count -ge 1 }
120+
121+
$billingAccount = Get-AzBillingAccount -Name $sampleBillingAccounts[0].Name
122+
123+
Assert-AreEqual $billingAccount.Id $sampleBillingAccounts[0].Id
124+
}
125+
126+
<#
127+
.SYNOPSIS
128+
Get billing account with specified names
129+
#>
130+
function Test-GetBillingAccountWithNames
131+
{
132+
$sampleBillingAccounts = Get-AzBillingAccount
133+
Assert-True { $sampleBillingAccounts.Count -ge 1 }
134+
135+
$billingAccounts = Get-AzBillingAccount -Name $sampleBillingAccounts.Name
136+
137+
Assert-AreEqual $sampleBillingAccounts.Count $billingAccounts.Count
138+
}
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.Billing.Test.ScenarioTests.ScenarioTest;
16+
using Microsoft.Azure.Commands.ScenarioTest;
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Xunit;
19+
20+
namespace Microsoft.Azure.Commands.Billing.Test.ScenarioTests
21+
{
22+
public class BillingProfilesTests
23+
{
24+
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;
25+
26+
public BillingProfilesTests(Xunit.Abstractions.ITestOutputHelper output)
27+
{
28+
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
29+
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
30+
TestExecutionHelpers.SetUpSessionAndProfile();
31+
}
32+
33+
[Fact]
34+
[Trait(Category.AcceptanceType, Category.CheckIn)]
35+
public void TestListBillingProfiles()
36+
{
37+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ListBillingProfiles");
38+
}
39+
40+
[Fact]
41+
[Trait(Category.AcceptanceType, Category.CheckIn)]
42+
public void TestGetBillingProfileWithName()
43+
{
44+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetBillingProfileWithName");
45+
}
46+
47+
[Fact]
48+
[Trait(Category.AcceptanceType, Category.CheckIn)]
49+
public void TestGetBillingProfileWithInvoiceSections()
50+
{
51+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetBillingProfileWithInvoiceSections");
52+
}
53+
54+
[Fact]
55+
[Trait(Category.AcceptanceType, Category.CheckIn)]
56+
public void TestGetBillingProfileByNameWithInvoiceSections()
57+
{
58+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-GetBillingProfileByNameWithInvoiceSections");
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)