-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ResourceListOperations tests (#22279)
* Change the accessbility to virtual for Resource.Id * Add ResourceListOperations tests Co-authored-by: m-nash <[email protected]> Co-authored-by: m-nash <[email protected]>
- Loading branch information
1 parent
76c4257
commit 3b72e05
Showing
3 changed files
with
8,907 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
sdk/resourcemanager/Azure.ResourceManager.Core/tests/Scenario/ResourceListOperationsTests.cs
This file contains 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,39 @@ | ||
using System.Threading.Tasks; | ||
using Azure.Core.TestFramework; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.ResourceManager.Core.Tests | ||
{ | ||
public class ResourceListOperationsTests : ResourceManagerTestBase | ||
{ | ||
public ResourceListOperationsTests(bool isAsync) | ||
: base(isAsync)//, RecordedTestMode.Record) | ||
{ | ||
} | ||
|
||
[TestCase] | ||
[RecordedTest] | ||
public async Task ListAtContext() | ||
{ | ||
ResourceGroup rg = await Client.DefaultSubscription.GetResourceGroups().Construct(LocationData.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg")); | ||
_ = await CreateGenericAvailabilitySetAsync(rg.Id); | ||
|
||
ResourceGroupOperations rgOp = Client.GetResourceGroupOperations(rg.Id); | ||
var result = 0; | ||
var pageable = ResourceListOperations.ListAtContextAsync(rgOp); | ||
await foreach (var resource in pageable) | ||
{ | ||
result++; | ||
} | ||
Assert.AreEqual(1, result); | ||
|
||
result = 0; | ||
pageable = ResourceListOperations.ListAtContextAsync(Client.DefaultSubscription); | ||
await foreach (var resource in pageable) | ||
{ | ||
result++; | ||
} | ||
Assert.GreaterOrEqual(result, 1); | ||
} | ||
} | ||
} |
Oops, something went wrong.