Skip to content

Commit 79ce62d

Browse files
authored
update tests after base class change (Azure#22936)
1 parent fb1c53b commit 79ce62d

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

sdk/core/Azure.Core.TestFramework/src/Instrumentation/ManagementInterceptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private bool InheritsFromOperationBase(Type elementType)
8989
if (elementType.BaseType == typeof(object))
9090
return false;
9191

92-
if (elementType.BaseType.Name == "OperationsBase")
92+
if (elementType.BaseType.Name == "ResourceOperations")
9393
return true;
9494

9595
return InheritsFromOperationBase(elementType.BaseType);

sdk/core/Azure.Core/tests/ManagementRecordedTestBaseTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ public void ValidateInstrumentGetOperations()
9090
}
9191

9292
[Test]
93-
public async Task ValidateInstrumentPhPageable()
93+
public async Task ValidateInstrumentPageable()
9494
{
9595
ManagementTestClient client = InstrumentClient(new ManagementTestClient());
9696
var testResources = client.GetTestResourceContainer();
97-
await foreach (var item in testResources.ListAsync())
97+
await foreach (var item in testResources.GetAllAsync())
9898
{
9999
Assert.AreEqual("TestResourceProxy", item.GetType().Name);
100100
Assert.AreEqual("success", item.Method());

sdk/core/Azure.Core/tests/TestClients/TestResourceContainer.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,23 @@
77
using System.Threading.Tasks;
88
using Azure.Core.Pipeline;
99
using Azure.Core.TestFramework;
10+
using Azure.ResourceManager;
11+
using Azure.ResourceManager.Core;
1012

1113
namespace Azure.Core.Tests
1214
{
13-
public class TestResourceContainer
15+
public class TestResourceContainer : ResourceContainer
1416
{
1517
private DiagnosticScopeFactory _diagnostic = new DiagnosticScopeFactory("Azure.Clients", "Microsoft.Azure.Core.Cool.Tests", true);
1618

17-
[ForwardsClientCalls]
18-
public virtual Pageable<TestResource> List(int pages = 1, CancellationToken cancellation = default)
19+
protected override ResourceType ValidResourceType => "MyFake.Namespace/testResource";
20+
21+
public virtual Pageable<TestResource> GetAll(int pages = 1, CancellationToken cancellation = default)
1922
{
2023
Page<TestResource> pageFunc(int? pageSizeHint)
2124
{
2225
//simulates forwarding with todays wrapper. This should go away after codegen is finished
23-
using var scope = _diagnostic.CreateScope("TestResourceContainer.GetSyncResults");
26+
using var scope = _diagnostic.CreateScope("TestResourceContainer.GetAll");
2427
scope.Start();
2528

2629
try
@@ -37,12 +40,11 @@ Page<TestResource> pageFunc(int? pageSizeHint)
3740
return PageableHelpers.CreateEnumerable(pageFunc, null);
3841
}
3942

40-
[ForwardsClientCalls]
41-
public virtual AsyncPageable<TestResource> ListAsync(int pages = 1, CancellationToken cancellation = default)
43+
public virtual AsyncPageable<TestResource> GetAllAsync(int pages = 1, CancellationToken cancellation = default)
4244
{
4345
async Task<Page<TestResource>> pageFunc(int? pageSizeHint)
4446
{
45-
using var scope = _diagnostic.CreateScope("TestResourceContainer.GetAsyncResults");
47+
using var scope = _diagnostic.CreateScope("TestResourceContainer.GetAll");
4648
scope.Start();
4749

4850
try

sdk/core/Azure.Core/tests/TestClients/TestResourceOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Azure.Core.Tests
1313
{
14-
public class TestResourceOperations : OperationsBase
14+
public class TestResourceOperations : ResourceOperations
1515
{
1616
private DiagnosticScopeFactory _diagnostic = new DiagnosticScopeFactory("Azure.Clients", "Microsoft.Azure.Core.Cool.Tests", true);
1717

0 commit comments

Comments
 (0)