Skip to content

Commit

Permalink
Add ResourceListOperations tests (#22279)
Browse files Browse the repository at this point in the history
* 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
3 people authored Jun 29, 2021
1 parent 76c4257 commit 3b72e05
Show file tree
Hide file tree
Showing 3 changed files with 8,907 additions and 0 deletions.
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);
}
}
}
Loading

0 comments on commit 3b72e05

Please sign in to comment.